@@ -590,6 +590,9 @@ the case where the values of the type variables do not satisfy their
590
590
declared bounds, and those values will be obtained directly from the static
591
591
type of the receiver in each member invocation on ` V ` .*
592
592
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
+
593
596
When ` s ` is zero,
594
597
<code >V< ; T<sub >1</sub >, .. T<sub >s</sub >> ; </code >
595
598
simply stands for ` V ` , a non-generic inline type.
@@ -642,6 +645,13 @@ and no actual argument part.
642
645
* Setter invocations are treated as invocations of methods with a
643
646
single argument.*
644
647
648
+ If ` e ` is an expression whose static type ` V ` is the inline type
649
+ <code >Inline< ; T<sub >1</sub >, .. T<sub >s</sub >> ; </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
+
645
655
* In the body of an inline class declaration _ DV_ with name ` Inline `
646
656
and type parameters
647
657
<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
704
714
705
715
We will omit 'declared' and 'instantiated' from the phrase when it is
706
716
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.*
710
720
711
721
Let ` V ` be an inline type of the form
712
722
<code >Inline< ; T<sub >1</sub >, .. T<sub >s</sub >> ; </code >,
713
723
and let ` R ` be the corresponding instantiated representation type.
714
724
` 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 .
716
726
717
727
* That is, an expression of an inline type can be assigned to a top type
718
728
(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
768
778
superinitializer. * That is, a term of the form ` super(...) ` or
769
779
` super.id(...) ` as the last element of the initializer list.*
770
780
781
+ A compile-time error occurs if an inline class constructor declares a
782
+ super parameter. * For instance, ` Inline(super.x); ` .*
783
+
771
784
* 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 ` .*
775
788
776
789
An instance creation expression of the form
777
790
<code >Inline< ; T<sub >1</sub >, .. T<sub >s</sub >> ; (...)</code >
@@ -788,6 +801,9 @@ constructors (in particular, it can occur by means of `this.id`, or in
788
801
an initializer list, or by an initializing expression in the
789
802
declaration itself, but it is an error if it does not occur at all).*
790
803
804
+ An inline type ` V ` used as an expression (* a type literal* ) is allowed
805
+ and has static type ` Type ` .
806
+
791
807
792
808
### Composing Inline Classes
793
809
@@ -987,9 +1003,14 @@ use a cast to introduce or discard the inline type, as the static type
987
1003
of an instance, or as a type argument in the static type of a data
988
1004
structure or function involving the inline type.*
989
1005
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.
993
1014
994
1015
995
1016
### Summary of Typing Relationships
0 commit comments