Debian Codegraph @

docs/locale/ja/LC_MESSAGES/tsttcpw.po

raw
1 # SOME DESCRIPTIVE TITLE.
2 # Copyright (C) 2020, The JSpecify Authors
3 # This file is distributed under the same license as the JSpecify package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: JSpecify \n"
10 "Report-Msgid-Bugs-To: \n"
11 "POT-Creation-Date: 2021-02-16 00:56+0000\n"
12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 "Language-Team: LANGUAGE <[email protected]>\n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=utf-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18 "Generated-By: Babel 2.8.0\n"
19
20 #: ../../tsttcpw.rst:2
21 msgid "The Simplest(?) Thing That Could Possibly Work for subtyping"
22 msgstr ""
23
24 #: ../../tsttcpw.rst:4
25 msgid ""
26 "**This is not “the JSpecify spec.” This is an initial attempt to formally"
27 " specify only a subset of the rules we’ll need for a subset of features "
28 "we wish to cover. Additionally, it deviates from some of our current "
29 "working decisions in an effort to remain simple.**"
30 msgstr ""
31
32 #: ../../tsttcpw.rst
33 msgid "High-level overview"
34 msgstr ""
35
36 #: ../../tsttcpw.rst:12
37 msgid ""
38 "It may be that some people will use this doc to guide their "
39 "implementations in the near future. Please don’t hesitate to let cpovirk "
40 "know of any confusing bits."
41 msgstr ""
42
43 #: ../../tsttcpw.rst:16
44 msgid ""
45 "I should probably preemptively clarify at least one thing. In this doc, I"
46 " have tried to distinguish explicitly between 3 “kinds of nullability” of"
47 " a given type usage. Each kind is derived (at least in part) from the "
48 "previous:"
49 msgstr ""
50
51 #: ../../tsttcpw.rst:21
52 msgid "What annotation (if any) appears directly on that type usage?"
53 msgstr ""
54
55 #: ../../tsttcpw.rst:22
56 msgid "What is the `nullness operator <#nullness-operator>`__ of that type usage?"
57 msgstr ""
58
59 #: ../../tsttcpw.rst:24
60 msgid "For that type usage…"
61 msgstr ""
62
63 #: ../../tsttcpw.rst:26
64 msgid "Is it safe to assume that is not ``null``?"
65 msgstr ""
66
67 #: ../../tsttcpw.rst:27
68 msgid "Is it safe to put a ``null`` into it?"
69 msgstr ""
70
71 #: ../../tsttcpw.rst:28
72 msgid "neither (as in “parametric nullness”)"
73 msgstr ""
74
75 #: ../../tsttcpw.rst:29
76 msgid "both (as in “unspecified nullness” in “lenient mode”)"
77 msgstr ""
78
79 #: ../../tsttcpw.rst:31
80 msgid "TODO(cpovirk): Link to my “Don’t say ‘nullable’” doc once I write it."
81 msgstr ""
82
83 #: ../../tsttcpw.rst:36
84 msgid "References to concepts defined by this spec"
85 msgstr ""
86
87 #: ../../tsttcpw.rst:38
88 msgid ""
89 "When a rule in this spec refers to any concept that is defined in this "
90 "spec (for example, `substitution <#substitution>`__ or `containment "
91 "<#containment>`__), apply this spec’s definition (as opposed to other "
92 "definitions, such as the ones in the JLS)."
93 msgstr ""
94
95 #: ../../tsttcpw.rst:43
96 msgid ""
97 "Additionally, when a rule in this spec refers to a JLS rule that in turn "
98 "refers to a concept that is defined in this spec, likewise apply this "
99 "spec’s definition."
100 msgstr ""
101
102 #: ../../tsttcpw.rst:47
103 msgid ""
104 "In particular, when a JLS rule refers to types, apply this spec’s "
105 "definition of `augmented types <#augmented-type>`__ (as oppposed to `base"
106 " types <https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
107 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__)."
108 msgstr ""
109
110 #: ../../tsttcpw.rst:53
111 msgid "Nullness operator"
112 msgstr ""
113
114 #: ../../tsttcpw.rst:55
115 msgid "An nullness operator is one of 4 values:"
116 msgstr ""
117
118 #: ../../tsttcpw.rst:57
119 msgid "``UNION_NULL``"
120 msgstr ""
121
122 #: ../../tsttcpw.rst:58
123 msgid "``NO_CHANGE``"
124 msgstr ""
125
126 #: ../../tsttcpw.rst:59
127 msgid "``UNSPECIFIED``"
128 msgstr ""
129
130 #: ../../tsttcpw.rst:60
131 msgid "``MINUS_NULL``"
132 msgstr ""
133
134 #: ../../tsttcpw.rst:64
135 msgid ""
136 "The distinction among these 4 values is similar to the distinction among "
137 "the Kotlin types ``Foo?``, ``Foo``, ``Foo!``, and ``Foo!!``, "
138 "respectively."
139 msgstr ""
140
141 #: ../../tsttcpw.rst:69
142 msgid "Augmented type"
143 msgstr ""
144
145 #: ../../tsttcpw.rst:71
146 msgid ""
147 "An augmented type consists of a `base type "
148 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
149 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__ and a "
150 "`nullness operator <#nullness-operator>`__ corresponding to *each* of its"
151 " `type components <https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf"
152 "--w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.g7gl9fwq1tt5>`__."
153 msgstr ""
154
155 #: ../../tsttcpw.rst:77
156 msgid ""
157 "This differs from our current `glossary definition "
158 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
159 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=id.367l48xhsikk>`__, which is "
160 "written in terms of a “nullness” for each component, not a “nullness "
161 "operator.” Still, the glossary’s concept of the “nullness” of a type is "
162 "derivable from the type’s nullness operator. Notably, the glossary’s "
163 "“nullable” type is our `least convenient world <#multiple-worlds>`__\\ ’s"
164 " `trusted null-inclusive under every parameterization <#trusted-null-"
165 "inclusive-under-every-parameterization>`__, and the glossary’s “non-"
166 "nullable” type is our least convenient world’s `trusted null-exclusive "
167 "under every parameterization <#trusted-null-exclusive-under-every-"
168 "parameterization>`__."
169 msgstr ""
170
171 #: ../../tsttcpw.rst:89
172 msgid ""
173 "For our purposes, base types (and thus augmented types) include not just "
174 "class and interface types, array types, and type variables but also "
175 "`intersection types <#intersection-types>`__ and the null type. This is "
176 "true even though the JLS sometimes does not supply rules for intersection"
177 " types and sometimes has separate rules for the null type."
178 msgstr ""
179
180 #: ../../tsttcpw.rst:95
181 msgid ""
182 "The goal of this spec is to define rules for augmented types compatible "
183 "with those that the JLS defines for base types."
184 msgstr ""
185
186 #: ../../tsttcpw.rst:98
187 msgid ""
188 "In almost all cases, this spec agrees with the JLS’s rules when "
189 "specifying what *base* types appear in a piece of code. It makes an "
190 "exception for `“Bound of an unbounded wildcard,” <#unbounded-wildcard>`__"
191 " for which it specifies a bound of ``Object`` that the JLS does not "
192 "specify."
193 msgstr ""
194
195 #: ../../tsttcpw.rst:104
196 msgid ""
197 "When this spec uses capital letters, they refer to augmented types "
198 "(unless otherwise noted). This is in contrast to the JLS, which typically"
199 " uses them to refer to base types."
200 msgstr ""
201
202 #: ../../tsttcpw.rst:108
203 msgid ""
204 "When this spec refers to “the nullness operator of” a type ``T``, it "
205 "refers specifically to the nullness operator of the type component that "
206 "is the entire type ``T``, without reference to the nullness operator of "
207 "any other type components of ``T``."
208 msgstr ""
209
210 #: ../../tsttcpw.rst:113
211 msgid ""
212 "For example, the nullness operator of ``List<@Nullable Object>`` would be"
213 " ``NO_CHANGE`` (at least in a `null-aware context <#null-aware-"
214 "context>`__), even though the nullness operator of its element type "
215 "``Object`` is ``UNION_NULL``."
216 msgstr ""
217
218 #: ../../tsttcpw.rst:119
219 msgid "Null-aware context"
220 msgstr ""
221
222 #: ../../tsttcpw.rst:121
223 msgid "To determine whether a type usage appears in a null-aware context:"
224 msgstr ""
225
226 #: ../../tsttcpw.rst:123
227 msgid ""
228 "Look for an ``@org.jspecify.annotations.NullAware`` annotation on any of "
229 "the enclosing scopes surrounding the type usage."
230 msgstr ""
231
232 #: ../../tsttcpw.rst:126
233 msgid ""
234 "Class members are enclosed by classes, which may be enclosed by other "
235 "class members or classes. and top-level classes are enclosed by packages,"
236 " which may be enclosed by modules."
237 msgstr ""
238
239 #: ../../tsttcpw.rst:130
240 msgid "Packages are *not* enclosed by “parent” packages."
241 msgstr ""
242
243 #: ../../tsttcpw.rst:134
244 msgid ""
245 "This definition of “enclosing” likely matches `the definition in the Java"
246 " compiler API "
247 "<https://docs.oracle.com/en/java/javase/14/docs/api/java.compiler/javax/lang/model/element/Element.html#getEnclosingElement()>`__."
248 msgstr ""
249
250 #: ../../tsttcpw.rst:138
251 msgid ""
252 "If an ``@org.jspecify.annotations.NullAware`` annotation exists on one of"
253 " these scopes, then the type usage is in a null-aware context. Otherwise,"
254 " it is not."
255 msgstr ""
256
257 #: ../../tsttcpw.rst:145
258 msgid "Augmented type of a type usage appearing in code"
259 msgstr ""
260
261 #: ../../tsttcpw.rst:147
262 msgid ""
263 "For most type usages in source code or bytecode on which JSpecify "
264 "nullness annotations are structurally valid, this section defines how to "
265 "determine their `augmented types <#augmented-type>`__. Note, however, "
266 "that rules for specific cases below take precedence over the general rule"
267 " here."
268 msgstr ""
269
270 #: ../../tsttcpw.rst:153
271 msgid ""
272 "Because the JLS already has rules for determining the `base type "
273 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
274 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__ for a type "
275 "usage, this section covers only how to determine its `nullness operator "
276 "<#nullness-operator>`__."
277 msgstr ""
278
279 #: ../../tsttcpw.rst:158
280 msgid ""
281 "To determine the nullness operator, apply the following rules in order. "
282 "Once one condition is met, skip the remaining conditions."
283 msgstr ""
284
285 #: ../../tsttcpw.rst:161
286 msgid ""
287 "If the type usage is annotated with "
288 "``@org.jspecify.annotations.Nullable``, its nullness operator is "
289 "``UNION_NULL``."
290 msgstr ""
291
292 #: ../../tsttcpw.rst:164
293 msgid ""
294 "If the type usage appears in a `null-aware context <#null-aware-"
295 "context>`__, its nullness operator is ``NO_CHANGE``."
296 msgstr ""
297
298 #: ../../tsttcpw.rst:167
299 msgid "Its nullness operator is ``UNSPECIFIED``."
300 msgstr ""
301
302 #: ../../tsttcpw.rst:171
303 msgid ""
304 "The choice of nullness operator is *not* affected by any nullness "
305 "operator that appears in a corresponding location in a supertype. For "
306 "example, if one type declares a method whose return type is annotated "
307 "``@Nullable``, and if another type overrides that method but does not "
308 "declare the return type as ``@Nullable``, then the override’s return type"
309 " will *not* have nullness operator ``UNION_NULL``."
310 msgstr ""
311
312 #: ../../tsttcpw.rst:178
313 msgid ""
314 "The rules here never produce the fourth nullness operator, "
315 "``MINUS_NULL``. (It will appear later in `substitution "
316 "<#substitution>`__. Additionally, we expect for tool authors to produce "
317 "``MINUS_NULL`` based on the results of null checks in implementation "
318 "code.) However, if tool authors prefer, they can safely produce "
319 "``MINUS_NULL`` in any case in which it is equivalent to ``NO_CHANGE``. "
320 "For example, there is no difference between a ``String`` with "
321 "``NO_CHANGE`` and a ``String`` with ``MINUS_NULL``."
322 msgstr ""
323
324 #: ../../tsttcpw.rst:190
325 msgid "Augmented type of an intersection type"
326 msgstr ""
327
328 #: ../../tsttcpw.rst:192
329 msgid ""
330 "Technically speaking, the JLS does not define syntax for an intersection "
331 "type. Instead, it defines a syntax for type parameters and casts that "
332 "supports multiple types. Then the intersection type is derived from "
333 "those. Intersection types can also arise from operations like `capture "
334 "conversion <#capture-conversion>`__. See `JLS 4.9 "
335 "<https://docs.oracle.com/javase/specs/jls/se14/html/jls-4.html#jls-4.9>`__."
336 msgstr ""
337
338 #: ../../tsttcpw.rst:199
339 msgid ""
340 "One result of all this is that it’s never possible for a programmer to "
341 "write an annotation “on an intersection type.”"
342 msgstr ""
343
344 #: ../../tsttcpw.rst:202
345 msgid ""
346 "This spec assigns a `nullness operator <#nullness-operator>`__ to each "
347 "individual element of an intersection type, following our normal rules "
348 "for type usages. It also assigns a nullness operator to the intersection "
349 "type as a whole. The nullness operator of the type as a whole is always "
350 "``NO_CHANGE``."
351 msgstr ""
352
353 #: ../../tsttcpw.rst:208
354 msgid ""
355 "This lets us provide, for every `base type "
356 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
357 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__, a rule for "
358 "computing its `augmented type <#augmented-type>`__. But we require "
359 "``NO_CHANGE`` so as to avoid questions like whether “a ``UNION_NULL`` "
360 "intersection type whose members are ``UNION_NULL`` ``Foo`` and "
361 "``UNION_NULL`` ``Bar``” is a subtype of “a ``NO_CHANGE`` intersection "
362 "type with those same members.” Plus, it would be difficult for tools to "
363 "output the nullness operator of an intersection type in a human-readable "
364 "way."
365 msgstr ""
366
367 #: ../../tsttcpw.rst:220
368 msgid ""
369 "To avoid ever creating an intersection type with a nullness operator "
370 "other than ``NO_CHANGE``, we define special handling for intersection "
371 "types under `“Applying a nullness operator to an augmented type.” "
372 "<#applying-operator>`__"
373 msgstr ""
374
375 #: ../../tsttcpw.rst:228
376 msgid "Bound of an “unbounded” wildcard"
377 msgstr ""
378
379 #: ../../tsttcpw.rst:230
380 msgid ""
381 "In source, an unbounded wildcard is written as ``<?>``. This section does"
382 " **not** apply to ``<? extends Object>``, even though that is often "
383 "equivalent to ``<?>``. See `JLS 4.5.1 "
384 "<https://docs.oracle.com/javase/specs/jls/se14/html/jls-4.html#jls-4.5.1>`__."
385 msgstr ""
386
387 #: ../../tsttcpw.rst:235
388 msgid ""
389 "In bytecode, such a wildcard is represented as a wildcard type with an "
390 "empty list of upper bounds and an empty list of lower bounds. This "
391 "section does **not** apply to a wildcard with any bounds in either list, "
392 "even a sole upper bound of ``Object``."
393 msgstr ""
394
395 #: ../../tsttcpw.rst:240
396 msgid ""
397 "For a wildcard with an explicit bound of ``Object`` (that is, ``<? "
398 "extends Object>``, perhaps with an annotation on ``Object``), instead "
399 "apply `the normal rules <#augmented-type-of-usage>`__ for the explicit "
400 "bound type."
401 msgstr ""
402
403 #: ../../tsttcpw.rst:245
404 msgid ""
405 "If an unbounded wildcard appears in a `null-aware context <#null-aware-"
406 "context>`__, then it has a single upper bound whose `base type "
407 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
408 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__ is ``Object`` "
409 "and whose `nullness operator <#nullness-operator>`__ is ``UNION_NULL``."
410 msgstr ""
411
412 #: ../../tsttcpw.rst:252
413 msgid ""
414 "If an unbounded wildcard appears outside a null-aware context, then it "
415 "has a single upper bound whose base type is ``Object`` and whose nullness"
416 " operator is ``UNSPECIFIED``."
417 msgstr ""
418
419 #: ../../tsttcpw.rst:256
420 msgid ""
421 "In both cases, we specify a bound that does not exist in the source or "
422 "bytecode, deviating from the JLS. Because the base type of the bound is "
423 "``Object``, this should produce no user-visible differences except to "
424 "tools that implement JSpecify nullness analysis."
425 msgstr ""
426
427 #: ../../tsttcpw.rst:261
428 msgid ""
429 "Whenever a JLS rule refers specifically to ``<?>``, disregard it, and "
430 "instead apply the rules for ``<? extends T>``, where ``T`` has a base "
431 "type of ``Object`` and the nullness operator defined by this section."
432 msgstr ""
433
434 #: ../../tsttcpw.rst:268
435 msgid "Bound of an ``Object``-bounded type parameter"
436 msgstr ""
437
438 #: ../../tsttcpw.rst:270
439 msgid ""
440 "In source, an ``Object``-bounded type parameter can be writen in either "
441 "of 2 ways:"
442 msgstr ""
443
444 #: ../../tsttcpw.rst:273
445 msgid "``<T>``"
446 msgstr ""
447
448 #: ../../tsttcpw.rst:274
449 msgid ""
450 "``<T extends Object>`` with no JSpecify nullness type annotations on the "
451 "bound"
452 msgstr ""
453
454 #: ../../tsttcpw.rst:277
455 msgid ""
456 "See `JLS 4.4 "
457 "<https://docs.oracle.com/javase/specs/jls/se14/html/jls-4.html#jls-4.4>`__."
458 msgstr ""
459
460 #: ../../tsttcpw.rst:280
461 msgid ""
462 "In bytecode, ``<T>`` and ``<T extends Object>`` are both represented as a"
463 " type parameter with only a single upper bound, ``Object``, and no "
464 "JSpecify nullness type annotations on the bound."
465 msgstr ""
466
467 #: ../../tsttcpw.rst:284
468 msgid ""
469 "If an ``Object``-bounded type parameter appears in a `null-aware context "
470 "<#null-aware-context>`__, then its bound has a `base type "
471 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
472 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__ of ``Object`` "
473 "and a `nullness operator <#nullness-operator>`__ of ``NO_CHANGE``."
474 msgstr ""
475
476 #: ../../tsttcpw.rst:290
477 msgid ""
478 "Note that this gives ``<T>`` a different bound than ``<?>`` (though only "
479 "in a null-aware context)."
480 msgstr ""
481
482 #: ../../tsttcpw.rst:293
483 msgid ""
484 "If an ``Object``-bounded type parameter appears outside a null-aware "
485 "context, then its bound has a base type of ``Object`` and a nullness "
486 "operator of ``UNSPECIFIED``."
487 msgstr ""
488
489 #: ../../tsttcpw.rst:297
490 msgid ""
491 "All these rules match the behavior of `our normal rules <#augmented-type-"
492 "of-usage>`__ for determining the `augmented type <#augmented-type>`__ of "
493 "the bound ``Object``. The only “special” part is that we consider the "
494 "source code ``<T>`` to have a bound of ``Object``, just as it does when "
495 "compiled to bytecode."
496 msgstr ""
497
498 #: ../../tsttcpw.rst:306
499 msgid "Augmented null types"
500 msgstr ""
501
502 #: ../../tsttcpw.rst:308
503 msgid ""
504 "The JLS refers to “the null type.” In this spec, we assign a `nullness "
505 "operator <#nullness-operator>`__ to all types, including the null type. "
506 "This produces multiple null types:"
507 msgstr ""
508
509 #: ../../tsttcpw.rst:312
510 msgid ""
511 "the null `base type "
512 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
513 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__ with nullness "
514 "operator ``NO_CHANGE``: the “bottom”/“nothing” type used in `capture "
515 "conversion <#capture-conversion>`__"
516 msgstr ""
517
518 #: ../../tsttcpw.rst:317
519 msgid "No value, including ``null`` itself, has this type."
520 msgstr ""
521
522 #: ../../tsttcpw.rst:319
523 msgid "the null base type with nullness operator ``MINUS_NULL``"
524 msgstr ""
525
526 #: ../../tsttcpw.rst:321
527 msgid ""
528 "This is equivalent to the previous type. Tools may use the 2 "
529 "interchangeably."
530 msgstr ""
531
532 #: ../../tsttcpw.rst:324
533 msgid ""
534 "the null base type with nullness operator ``UNION_NULL``: the type of the"
535 " null reference"
536 msgstr ""
537
538 #: ../../tsttcpw.rst:327
539 msgid "the null base type with nullness operator ``UNSPECIFIED``"
540 msgstr ""
541
542 #: ../../tsttcpw.rst:329
543 msgid "This may be relevant only in implementation code."
544 msgstr ""
545
546 #: ../../tsttcpw.rst:334
547 msgid "The least convenient world and the most convenient world"
548 msgstr ""
549
550 #: ../../tsttcpw.rst:336
551 msgid ""
552 "Some of the rules in this spec come in 2 versions, 1 for “the least "
553 "convenient world” and 1 for “the most convenient world.”"
554 msgstr ""
555
556 #: ../../tsttcpw.rst:339
557 msgid "Tools may implement either or both versions of the rules."
558 msgstr ""
559
560 #: ../../tsttcpw.rst:341
561 msgid ""
562 "Our goal is to allow tools and their users to choose their desired level "
563 "of strictness in the presence of ``UNSPECIFIED``. “The least convenient "
564 "world” usually assumes that types are incompatible unless it has enough "
565 "information to prove they are compatible; “the most convenient world” "
566 "assumes that types are compatible unless it has enough information to "
567 "prove they are incompatible."
568 msgstr ""
569
570 #: ../../tsttcpw.rst:348
571 msgid ""
572 "Thus, strict tools may want to implement the least-convenient-world "
573 "version of rules, and lenient tools may wish to implement the most-"
574 "convenient-world version. Or a tool might implement both and let users "
575 "select which rules to apply."
576 msgstr ""
577
578 #: ../../tsttcpw.rst:353
579 msgid ""
580 "Another possibility is for a tool to implement both versions and to use "
581 "that to distinguish between “errors” and “warnings.” Such a tool might "
582 "run each check first in the least convenient world and then, if the check"
583 " fails, run it again in the most convenient world. If the check fails in "
584 "both worlds, the tool would produce an error. If it passes only because "
585 "of the most convenient interpretation, the tool would produce a warning."
586 msgstr ""
587
588 #: ../../tsttcpw.rst:361
589 msgid ""
590 "The main body of each section describes the *least*-convenient-world "
591 "rule. If the most-convenient-world rule differs, the differences are "
592 "explained at the end."
593 msgstr ""
594
595 #: ../../tsttcpw.rst:368
596 msgid "Propagating the most/least convenient world"
597 msgstr ""
598
599 #: ../../tsttcpw.rst:370
600 msgid ""
601 "When one rule in this spec refers to another, it refers to the rule for "
602 "the same “world.” For example, when the rules for `containment "
603 "<#containment>`__ refer to the rules for `subtyping <#subtyping>`__, the "
604 "most-convenient-world containment check applies the most-convenient-world"
605 " subtyping check, and the least-convenient-world containment check "
606 "applies the least-convenient-world subtyping check."
607 msgstr ""
608
609 #: ../../tsttcpw.rst:378
610 msgid ""
611 "This applies even if a rule says it is the same for both worlds: It means"
612 " “the same except that any other rules are applied in the corresponding "
613 "world.”"
614 msgstr ""
615
616 #: ../../tsttcpw.rst:383
617 msgid "Same type"
618 msgstr ""
619
620 #: ../../tsttcpw.rst:385
621 msgid ""
622 "``S`` and ``T`` are the same type if ``S`` is a `subtype <#subtyping>`__ "
623 "of ``T`` and ``T`` is a subtype of ``S``."
624 msgstr ""
625
626 #: ../../tsttcpw.rst:389
627 msgid "Subtyping"
628 msgstr ""
629
630 #: ../../tsttcpw.rst:391
631 msgid "``A`` is a subtype of ``F`` if both of the following conditions are met:"
632 msgstr ""
633
634 #: ../../tsttcpw.rst:393
635 msgid ""
636 "``A`` is a subtype of ``F`` according to the `nullness-delegating "
637 "subtyping rules for Java <#nullness-delegating-subtyping>`__."
638 msgstr ""
639
640 #: ../../tsttcpw.rst:395
641 msgid "``A`` is a `nullness subtype <#nullness-subtyping>`__ of ``F``."
642 msgstr ""
643
644 #: ../../tsttcpw.rst:400
645 msgid "Nullness-delegating subtyping rules for Java"
646 msgstr ""
647
648 #: ../../tsttcpw.rst:402
649 msgid ""
650 "The Java subtyping rules are defined in `JLS 4.10 "
651 "<https://docs.oracle.com/javase/specs/jls/se14/html/jls-4.html#jls-4.10>`__."
652 " We add to them as follows:"
653 msgstr ""
654
655 #: ../../tsttcpw.rst:406
656 msgid ""
657 "`As always <#concept-references>`__, interpret the Java rules as "
658 "operating on `augmented types <#augmented-type>`__, not `base types "
659 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
660 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__. However, when"
661 " applying the Java direct-supertype rules themselves, *ignore* the "
662 "`nullness operator <#nullness-operator>`__ of the input types and output "
663 "types. The augmented types matter only when the Java rules refer to "
664 "*other* rules that are defined in this spec. *Those* rules respect the "
665 "nullness operator of some type components — but never the nullness "
666 "operator of the type component that represents the whole input or output "
667 "type."
668 msgstr ""
669
670 #: ../../tsttcpw.rst:417
671 msgid ""
672 "To “ignore” the output’s nullness operator, we recommend outputting a "
673 "value of ``NO_CHANGE``, since that is valid for all types, including "
674 "`intersection types <#intersection-types>`__."
675 msgstr ""
676
677 #: ../../tsttcpw.rst:421
678 msgid ""
679 "When the Java array rules require one type to be a *direct* supertype of "
680 "another, consider the direct supertypes of ``T`` to be *every* type that "
681 "``T`` is a `subtype <#subtyping>`__ of (as always, applying the "
682 "definition of subtyping in this spec)."
683 msgstr ""
684
685 #: ../../tsttcpw.rst:427
686 msgid "Nullness subtyping"
687 msgstr ""
688
689 #: ../../tsttcpw.rst:429
690 msgid ""
691 "The primary complication in subtyping comes from type-variable usages. "
692 "Our rules for them must account for every combination of type arguments "
693 "with which a given generic type can be parameterized."
694 msgstr ""
695
696 #: ../../tsttcpw.rst:433
697 msgid ""
698 "``A`` is a nullness subtype of ``F`` if any of the following conditions "
699 "are met:"
700 msgstr ""
701
702 #: ../../tsttcpw.rst:436
703 msgid ""
704 "``F`` is `trusted null-inclusive under every parameterization <#trusted-"
705 "null-inclusive-under-every-parameterization>`__."
706 msgstr ""
707
708 #: ../../tsttcpw.rst:438
709 msgid ""
710 "``A`` is `trusted null-exclusive under every parameterization <#trusted-"
711 "null-exclusive-under-every-parameterization>`__."
712 msgstr ""
713
714 #: ../../tsttcpw.rst:440
715 msgid ""
716 "``A`` has a `nullness-subtype-establishing path <#nullness-subtype-"
717 "establishing-path>`__ to any type whose base type is the same as the base"
718 " type of ``F``."
719 msgstr ""
720
721 #: ../../tsttcpw.rst:444
722 msgid "Nullness subtyping (and thus subtyping itself) is *not* transitive."
723 msgstr ""
724
725 #: ../../tsttcpw.rst:446
726 msgid ""
727 "(Contrast this with our `nullness-delegating subtyping <#nullness-"
728 "delegating-subtyping>`__ rules and `containment <#containment>`__ rules: "
729 "Each of those is defined as a transitive closure. However, technically "
730 "speaking, `there are cases in which those should not be transitive, "
731 "either <https://groups.google.com/d/msg/jspecify-"
732 "dev/yPnkx_GSb0Q/hLgS_431AQAJ>`__. Fortunately, this “mostly transitive” "
733 "behavior is exactly the behavior that implementations are likely to "
734 "produce naturally. Maybe someday we will find a way to specify this fully"
735 " correctly.)"
736 msgstr ""
737
738 #: ../../tsttcpw.rst:456
739 msgid "Nullness subtyping (and thus subtyping itself) is *not* reflexive."
740 msgstr ""
741
742 #: ../../tsttcpw.rst:458
743 msgid ""
744 "It does end up being reflexive in the `most convenient world <#multiple-"
745 "worlds>`__. We don’t state that as a rule for 2 reasons: First, it arises"
746 " naturally from the definitions in that world. Second, we don’t want to "
747 "suggest that subtyping is reflexive in the `least convenient world "
748 "<#multiple-worlds>`__."
749 msgstr ""
750
751 #: ../../tsttcpw.rst:465
752 msgid "Trusted null-inclusive under every parameterization"
753 msgstr ""
754
755 #: ../../tsttcpw.rst:467
756 msgid ""
757 "A type is trusted null-inclusive under every parameterization if it meets"
758 " either of the following conditions:"
759 msgstr ""
760
761 #: ../../tsttcpw.rst:470
762 msgid "Its `nullness operator <#nullness-operator>`__ is ``UNION_NULL``."
763 msgstr ""
764
765 #: ../../tsttcpw.rst:471
766 msgid ""
767 "It is an `intersection type <#intersection-types>`__ whose elements all "
768 "are trusted null-inclusive under every parameterization."
769 msgstr ""
770
771 #: ../../tsttcpw.rst:474
772 msgid ""
773 "**Most convenient world:** The rule is the same except that the "
774 "requirement for “``UNION_NULL``” is loosened to “``UNION_NULL`` or "
775 "``UNSPECIFIED``.”"
776 msgstr ""
777
778 #: ../../tsttcpw.rst:479
779 msgid "Trusted null-exclusive under every parameterization"
780 msgstr ""
781
782 #: ../../tsttcpw.rst:481
783 msgid ""
784 "A type is trusted null-exclusive under every parameterization if it has a"
785 " `nullness-subtype-establishing path <#nullness-subtype-establishing-"
786 "path>`__ to either of the following:"
787 msgstr ""
788
789 #: ../../tsttcpw.rst:486
790 msgid ""
791 "any type whose `nullness operator <#nullness-operator>`__ is "
792 "``MINUS_NULL``"
793 msgstr ""
794
795 #: ../../tsttcpw.rst:489
796 msgid "any augmented class or array type"
797 msgstr ""
798
799 #: ../../tsttcpw.rst:491
800 msgid ""
801 "This rule refers specifically to a “class or array type,” as distinct "
802 "from other types like type variables and `intersection types "
803 "<#intersection-types>`__."
804 msgstr ""
805
806 #: ../../tsttcpw.rst:496
807 msgid "Nullness-subtype-establishing path"
808 msgstr ""
809
810 #: ../../tsttcpw.rst:498
811 msgid ""
812 "``A`` has a nullness-subtype-establishing path to ``F`` if both of the "
813 "following hold:"
814 msgstr ""
815
816 #: ../../tsttcpw.rst:501
817 msgid ""
818 "``A`` has `nullness operator <#nullness-operator>`__ ``NO_CHANGE`` or "
819 "``MINUS_NULL``."
820 msgstr ""
821
822 #: ../../tsttcpw.rst:504
823 msgid ""
824 "There is a path from ``A`` to ``F`` through `nullness-subtype-"
825 "establishing direct-supertype edges <#nullness-subtype-establishing-"
826 "direct-supertype-edges>`__."
827 msgstr ""
828
829 #: ../../tsttcpw.rst:508
830 msgid ""
831 "The path may be empty. That is, ``A`` has a nullness-subtype-establishing"
832 " path to itself — as long as it has one of the required nullness "
833 "operators."
834 msgstr ""
835
836 #: ../../tsttcpw.rst:512
837 msgid ""
838 "**Most convenient world:** The rules are the same except that the "
839 "requirement for “``NO_CHANGE`` or ``MINUS_NULL``” is loosened to "
840 "“``NO_CHANGE``, ``MINUS_NULL``, or ``UNSPECIFIED``.”"
841 msgstr ""
842
843 #: ../../tsttcpw.rst:517
844 msgid "Nullness-subtype-establishing direct-supertype edges"
845 msgstr ""
846
847 #: ../../tsttcpw.rst:519
848 msgid ""
849 "``T`` has nullness-subtype-establishing direct-supertype edges to the "
850 "union of the nodes computed by the following 2 rules:"
851 msgstr ""
852
853 #: ../../tsttcpw.rst:522
854 msgid "Upper-bound rule:"
855 msgstr ""
856
857 #: ../../tsttcpw.rst:524
858 msgid ""
859 "if ``T`` is an augmented `intersection type <#intersection-types>`__: all"
860 " the intersection type’s elements whose `nullness operator <#nullness-"
861 "operator>`__ is ``NO_CHANGE`` or ``MINUS_NULL``"
862 msgstr ""
863
864 #: ../../tsttcpw.rst:527
865 msgid ""
866 "if ``T`` is an augmented type variable: all the corresponding type "
867 "parameter’s upper bounds whose nullness operator is ``NO_CHANGE`` or "
868 "``MINUS_NULL``"
869 msgstr ""
870
871 #: ../../tsttcpw.rst:530 ../../tsttcpw.rst:544
872 msgid "otherwise: no nodes"
873 msgstr ""
874
875 #: ../../tsttcpw.rst:532
876 msgid "Lower-bound rule:"
877 msgstr ""
878
879 #: ../../tsttcpw.rst:534
880 msgid ""
881 "for every type parameter ``P`` that has a lower bound whose `base type "
882 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
883 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__ is the same as"
884 " ``T``\\ ’s base type and whose nullness operator is ``NO_CHANGE``: the "
885 "type variable ``P``"
886 msgstr ""
887
888 #: ../../tsttcpw.rst:539
889 msgid ""
890 "TODO(cpovirk): What if the lower bound has some other nullness operator? "
891 "I’m pretty sure that we want to allow ``UNSPECIFIED`` in the most "
892 "convenient world (as we did before my recent edits), and we may want to "
893 "allow more."
894 msgstr ""
895
896 #: ../../tsttcpw.rst:546
897 msgid ""
898 "**Most convenient world:** The rules are the same except that the "
899 "requirements for “``NO_CHANGE`` or ``MINUS_NULL``” are loosened to "
900 "“``NO_CHANGE``, ``MINUS_NULL``, or ``UNSPECIFIED``.”"
901 msgstr ""
902
903 #: ../../tsttcpw.rst:551
904 msgid "Containment"
905 msgstr ""
906
907 #: ../../tsttcpw.rst:553
908 msgid ""
909 "The Java rules are defined in `JLS 4.5.1 "
910 "<https://docs.oracle.com/javase/specs/jls/se14/html/jls-4.html#jls-4.5.1>`__."
911 " We add to them as follows:"
912 msgstr ""
913
914 #: ../../tsttcpw.rst:557
915 msgid ""
916 "Disregard the 2 rules that refer to a bare ``?``. Instead, treat ``?`` "
917 "like ``? extends Object``, where the `nullness operator <#nullness-"
918 "operator>`__ of the ``Object`` bound is specified by `“Bound of an "
919 "unbounded wildcard.” <#unbounded-wildcard>`__"
920 msgstr ""
921
922 #: ../../tsttcpw.rst:562 ../../tsttcpw.rst:686
923 msgid ""
924 "This is just a part of our universal rule to treat a bare ``?`` like ``? "
925 "extends Object``."
926 msgstr ""
927
928 #: ../../tsttcpw.rst:565
929 msgid ""
930 "The rule written specifically for ``? extends Object`` applies only if "
931 "the nullness operator of the ``Object`` bound is ``UNION_NULL``."
932 msgstr ""
933
934 #: ../../tsttcpw.rst:568
935 msgid ""
936 "When the JLS refers to the same type ``T`` on both sides of a rule, the "
937 "rule applies if and only if this spec defines the 2 types to be the `same"
938 " type <#same-type>`__."
939 msgstr ""
940
941 #: ../../tsttcpw.rst:572
942 msgid ""
943 "**Most convenient world:** The rules are the same except that the "
944 "requirement for “``UNION_NULL``” is loosened to “``UNION_NULL`` or "
945 "``UNSPECIFIED``.”"
946 msgstr ""
947
948 #: ../../tsttcpw.rst:577
949 msgid "Substitution"
950 msgstr ""
951
952 #: ../../tsttcpw.rst:579
953 msgid ""
954 "Substitution on Java base types barely requires an explanation: See `JLS "
955 "1.3 "
956 "<https://docs.oracle.com/javase/specs/jls/se14/html/jls-1.html#jls-1.3>`__."
957 " Substitution on `augmented types <#augmented-type>`__, however, is "
958 "trickier: If ``Map.get`` returns “``V`` with `nullness operator "
959 "<#nullness-operator>`__ ``UNION_NULL``,” and if a user has a map whose "
960 "value type is “``String`` with nullness operator ``UNSPECIFIED``,” then "
961 "what does its ``get`` method return? Naive substitution would produce "
962 "“``String`` with nullness operator ``UNSPECIFIED`` with nullness operator"
963 " ``UNION_NULL``.” To reduce that to a proper augmented type with a single"
964 " nullness operator, we define this process."
965 msgstr ""
966
967 #: ../../tsttcpw.rst:592
968 msgid ""
969 "To substitute each type argument ``Aᵢ`` for each corresponding type "
970 "parameter ``Pᵢ``:"
971 msgstr ""
972
973 #: ../../tsttcpw.rst:595
974 msgid ""
975 "For every type-variable usage ``V`` whose `base type "
976 "<https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--"
977 "w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=kix.k81vs7t5p45i>`__ is ``Pᵢ``, "
978 "replace ``V`` with the result of the following operation:"
979 msgstr ""
980
981 #: ../../tsttcpw.rst:599
982 msgid ""
983 "If ``V`` is `trusted null-exclusive under every parameterization "
984 "<#trusted-null-exclusive-under-every-parameterization>`__ in the `least "
985 "convenient world <#multiple-worlds>`__, then replace it with the result "
986 "of `applying <#applying-operator>`__ ``MINUS_NULL`` to ``Aᵢ``."
987 msgstr ""
988
989 #: ../../tsttcpw.rst:605
990 msgid ""
991 "This is the one instance in which a rule references another rule to be "
992 "run under a *different* “world.” Normally, all rules are run `under the "
993 "same “world.” <#propagating-multiple-worlds>`__ But in this instance, the"
994 " null-exclusivity rule (and all rules that it in turn applies) are always"
995 " run in the least convenient world."
996 msgstr ""
997
998 #: ../../tsttcpw.rst:613
999 msgid ""
1000 "This special case improves behavior in “the ``ImmutableList.Builder`` "
1001 "case”: Consider an unannotated user of that class. Its builder will have "
1002 "an element type whose `nullness operator <#nullness-operator>`__ is "
1003 "``UNSPECIFIED``. Without this special case, "
1004 "``builder.add(objectUnionNull)`` would pass the subtyping check in the "
1005 "`most convenient world <#multiple-worlds>`__. This would happen even "
1006 "though we have enough information to know that the parameter to ``add`` "
1007 "is universally null-exclusive — even in the most convenient world. The "
1008 "special case here makes that subtyping check fail."
1009 msgstr ""
1010
1011 #: ../../tsttcpw.rst:624
1012 msgid ""
1013 "Otherwise, replace ``V`` with the result of applying the nullness "
1014 "operator of ``V`` to ``Aᵢ``."
1015 msgstr ""
1016
1017 #: ../../tsttcpw.rst:630
1018 msgid "Applying a nullness operator to an augmented type"
1019 msgstr ""
1020
1021 #: ../../tsttcpw.rst:632
1022 msgid ""
1023 "The process of applying a `nullness operator <#nullness-operator>`__ "
1024 "requires 2 inputs:"
1025 msgstr ""
1026
1027 #: ../../tsttcpw.rst:635
1028 msgid "the nullness operator to apply"
1029 msgstr ""
1030
1031 #: ../../tsttcpw.rst:636
1032 msgid ""
1033 "the `augmented type <#augmented-type>`__ (which, again, includes a "
1034 "`nullness operator <#nullness-operator>`__ for that type) to apply it to"
1035 msgstr ""
1036
1037 #: ../../tsttcpw.rst:640
1038 msgid "The result of the process is an augmented type."
1039 msgstr ""
1040
1041 #: ../../tsttcpw.rst:642
1042 msgid "The process is as follows:"
1043 msgstr ""
1044
1045 #: ../../tsttcpw.rst:644
1046 msgid ""
1047 "First, based on the pair of nullness operators (the one to apply and the "
1048 "one from the augmented type), compute a “desired nullness operator.” Do "
1049 "so by applying the following rules in order. Once one condition is met, "
1050 "skip the remaining conditions."
1051 msgstr ""
1052
1053 #: ../../tsttcpw.rst:649
1054 msgid ""
1055 "If the nullness operator to apply is ``MINUS_NULL``, the desired nullness"
1056 " operator is ``MINUS_NULL``."
1057 msgstr ""
1058
1059 #: ../../tsttcpw.rst:651
1060 msgid ""
1061 "If either nullness operator is ``UNION_NULL``, the desired nullness "
1062 "operator is ``UNION_NULL``."
1063 msgstr ""
1064
1065 #: ../../tsttcpw.rst:653
1066 msgid ""
1067 "If either nullness operator is ``UNSPECIFIED``, the desired nullness "
1068 "operator is ``UNSPECIFIED``."
1069 msgstr ""
1070
1071 #: ../../tsttcpw.rst:655
1072 msgid "The desired nullness operator is ``NO_CHANGE``."
1073 msgstr ""
1074
1075 #: ../../tsttcpw.rst:657
1076 msgid ""
1077 "Then, if the input augmented type is *not* an `intersection type "
1078 "<#intersection-types>`__, the output is the same as the input but with "
1079 "its nullness operator replaced with the desired nullness operator."
1080 msgstr ""
1081
1082 #: ../../tsttcpw.rst:661
1083 msgid ""
1084 "Otherwise, the output is an intersection type. For every element ``Tᵢ`` "
1085 "of the input type, the output type has an element that is the result of "
1086 "applying the desired nullness operator to ``Tᵢ``."
1087 msgstr ""
1088
1089 #: ../../tsttcpw.rst:665
1090 msgid ""
1091 "In this case, the desired nullness operator is always equal to the "
1092 "nullness operator to apply that was an input to this process. That’s "
1093 "because the nullness operator of the intersection type itself is defined "
1094 "to always be ``NO_CHANGE``."
1095 msgstr ""
1096
1097 #: ../../tsttcpw.rst:671
1098 msgid "Capture conversion"
1099 msgstr ""
1100
1101 #: ../../tsttcpw.rst:673
1102 msgid ""
1103 "The Java rules are defined in `JLS 5.1.10 "
1104 "<https://docs.oracle.com/javase/specs/jls/se14/html/jls-5.html#jls-5.1.10>`__."
1105 " We add to them as follows:"
1106 msgstr ""
1107
1108 #: ../../tsttcpw.rst:677
1109 msgid ""
1110 "The parameterized type that is the output of the conversion has the same "
1111 "`nullness operator <#nullness-operator>`__ as the parameterized type that"
1112 " is the input type."
1113 msgstr ""
1114
1115 #: ../../tsttcpw.rst:681
1116 msgid ""
1117 "Disregard the JLS rule about ``<?>``. Instead, treat ``?`` like ``? "
1118 "extends Object``, where the `nullness operator <#nullness-operator>`__ of"
1119 " the ``Object`` bound is specified by `“Bound of an unbounded wildcard.” "
1120 "<#unbounded-wildcard>`__"
1121 msgstr ""
1122
1123 #: ../../tsttcpw.rst:689
1124 msgid ""
1125 "When a rule generates a lower bound that is the null type, we specify "
1126 "that its nullness operator is ``NO_CHANGE``. (See `“Augmented null "
1127 "types.” <#null-types>`__)"
1128 msgstr ""
1129