You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d48780b
Browse filesBrowse the repository at this point in the historyBrowse files
Why:
`@notUndefined` was parsed, checked on declarations and checked on
abbreviations apart from `@instanceOf` and `@typeOf`, so each step had
two versions, and a type could carry it beside the others.
`process_runtime_annotation` returns `Not_undefined` as well, so one parse
feeds `declaration_shape`, the check for represented types and
`Typedecl.check_manifest_annotation`, which now checks all three on an
abbreviation. `Typeopt.abstractness` takes a type and is what
`undefinedness` falls back to.
Diagnostic changed (two of the three annotations):
Example:
@notundefined@typeof("string") type t
Before (diagnostic): none
After (diagnostic):
A type can have only one of @notundefined, @instanceof and @typeof.
@instanceof and @typeof already imply @notundefined.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CMkrYaktctdKc4M41WF36t
Signed-off-by: Christoph Knittel <ck@cca.io>
Copy file name to clipboardExpand all lines: compiler/ml/UntaggedVariants.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,8 +139,8 @@ level implying the one before:
139
139
-`@instanceOf("C")`: they are instances of the global class at the path `C`,
140
140
such as `"Date"` or `"Intl.Locale"`.
141
141
142
-
A type has at most one of `@typeOf` and `@instanceOf`, and only abstract types
143
-
and type abbreviations, public or private, can have any of the three.
142
+
A type has at most one of the three, and only abstract types and type
143
+
abbreviations, public or private, can have one.
144
144
`@notUndefined` affects only rule 12: `option` of the type, and of an untagged
145
145
variant with a payload of the type, is unboxed. It does not make the type a
146
146
recognized payload kind (rule 4).
@@ -189,7 +189,7 @@ would `type dog = animal<int>` or `type dog = phantom<int>` with
189
189
|`@instanceOf("Dog") type dog = animal`, `= animal<int>`, or `= phantom<int>` with `type phantom<'a> = animal`| A subclass must be a private abbreviation ... |`instance_of_public_subclass.res`, `instance_of_public_subclass_instance.res`, `instance_of_public_subclass_through_alias.res`|
190
190
|`@instanceOf("Animal") type t = private dog`| Animal appears twice in this chain of abbreviations ... |`instance_of_class_twice_in_chain.res`|
191
191
| any of the three on a record or variant |@instanceOf can only be used on abstract types and type abbreviations ... |`runtime_annotation_on_record.res`, `invalid_attribute_not_undefined.res`|
192
-
|both `@instanceOf` and `@typeOf`| A type can have either @instanceOfor@typeOf, not both.|`runtime_annotation_conflict.res`|
192
+
|two of the three| A type can have only one of @notUndefined, @instanceOfand@typeOf. ...|`runtime_annotation_conflict.res`, `runtime_annotation_not_undefined_conflict.res`|
193
193
| one annotation twice | Duplicate @instanceOf annotation; a type can have only one. |`instance_of_duplicate.res`|
194
194
195
195
What an interface states about a type must hold for its implementation. A
0 commit comments