Skip to content

Commit 5267617

Browse files
committed
Response to even more review comments
1 parent d02afc2 commit 5267617

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

accepted/future-releases/inline-classes/feature-specification.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,9 @@ the case where the values of the type variables do not satisfy their
590590
declared bounds, and those values will be obtained directly from the static
591591
type of the receiver in each member invocation on `V`.*
592592

593+
A compile-time error occurs if a type parameter of an inline class
594+
occurs in a non-covariant position in the representation type.
595+
593596
When `s` is zero,
594597
<code>V&lt;T<sub>1</sub>, .. T<sub>s</sub>&gt;</code>
595598
simply stands for `V`, a non-generic inline type.
@@ -642,6 +645,13 @@ and no actual argument part.
642645
*Setter invocations are treated as invocations of methods with a
643646
single argument.*
644647

648+
If `e` is an expression whose static type `V` is the inline type
649+
<code>Inline&lt;T<sub>1</sub>, .. T<sub>s</sub>&gt;</code>
650+
and `V` has no member whose basename is the basename of `m`, a member
651+
access like `e.m(args)` may be an extension member access, following
652+
the normal rules about applicability and accessibility of extensions,
653+
in particular that `V` must match the on-type of the extension.
654+
645655
*In the body of an inline class declaration _DV_ with name `Inline`
646656
and type parameters
647657
<code>X<sub>1</sub>, .. X<sub>s</sub></code>, for an invocation like
@@ -704,15 +714,15 @@ is `R`, and the _instantiated representation type_ corresponding to
704714

705715
We will omit 'declared' and 'instantiated' from the phrase when it is
706716
clear from the context whether we are talking about the inline class
707-
itself, or we're talking a particular instantiation of a generic
708-
inline. *For non-generic inline classes, the representation type is
709-
the same in either case.*
717+
itself, or we're talking about a particular instantiation of a generic
718+
inline class. *For non-generic inline classes, the representation type
719+
is the same in either case.*
710720

711721
Let `V` be an inline type of the form
712722
<code>Inline&lt;T<sub>1</sub>, .. T<sub>s</sub>&gt;</code>,
713723
and let `R` be the corresponding instantiated representation type.
714724
`V` is a proper subtype of `Object?`. If `R` is non-nullable then `V`
715-
is a proper subtype of `Object` as well.
725+
is a proper subtype of `Object` as well, and non-nullable.
716726

717727
*That is, an expression of an inline type can be assigned to a top type
718728
(like all other expressions), and if the representation type is
@@ -768,10 +778,13 @@ A compile-time error occurs if an inline class constructor includes a
768778
superinitializer. *That is, a term of the form `super(...)` or
769779
`super.id(...)` as the last element of the initializer list.*
770780

781+
A compile-time error occurs if an inline class constructor declares a
782+
super parameter. *For instance, `Inline(super.x);`.*
783+
771784
*In the body of a generative inline class constructor, the static type
772-
of `this` is the same as it is in any instance member of the inline,
773-
that is, `Inline<X1 .. Xk>`, where `X1 .. Xk` are the type parameters
774-
declared by `Inline`.*
785+
of `this` is the same as it is in any instance member of the inline
786+
class, that is, `Inline<X1 .. Xk>`, where `X1 .. Xk` are the type
787+
parameters declared by `Inline`.*
775788

776789
An instance creation expression of the form
777790
<code>Inline&lt;T<sub>1</sub>, .. T<sub>s</sub>&gt;(...)</code>
@@ -788,6 +801,9 @@ constructors (in particular, it can occur by means of `this.id`, or in
788801
an initializer list, or by an initializing expression in the
789802
declaration itself, but it is an error if it does not occur at all).*
790803

804+
An inline type `V` used as an expression (*a type literal*) is allowed
805+
and has static type `Type`.
806+
791807

792808
### Composing Inline Classes
793809

@@ -987,9 +1003,14 @@ use a cast to introduce or discard the inline type, as the static type
9871003
of an instance, or as a type argument in the static type of a data
9881004
structure or function involving the inline type.*
9891005

990-
A type test, `o is U` or `o is! U`, and a type cast, `o as U`, where `U` is
991-
or contains an inline type, is performed at run time as a type test and type
992-
cast on the run-time representation of the inline type as described above.
1006+
A type test, `o is U` or `o is! U`, and a type cast, `o as U`, where
1007+
`U` is or contains an inline type, is performed at run time as a type
1008+
test and type cast on the run-time representation of the inline type
1009+
as described above.
1010+
1011+
An inline type `V` used as an expression (*a type literal*) evaluates
1012+
to the value of the corresponding instantiated representation type
1013+
used as an expression.
9931014

9941015

9951016
### Summary of Typing Relationships

0 commit comments

Comments
 (0)