File tree 4 files changed +6
-9
lines changed
compiler/src/dotty/tools/dotc
library/src/scala/annotation/internal
4 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -921,7 +921,6 @@ class Definitions {
921
921
@ tu lazy val ParamMetaAnnot : ClassSymbol = requiredClass(" scala.annotation.meta.param" )
922
922
@ tu lazy val SetterMetaAnnot : ClassSymbol = requiredClass(" scala.annotation.meta.setter" )
923
923
@ tu lazy val ShowAsInfixAnnot : ClassSymbol = requiredClass(" scala.annotation.showAsInfix" )
924
- @ tu lazy val StableAnnot : ClassSymbol = requiredClass(" scala.annotation.internal.Stable" )
925
924
@ tu lazy val FunctionalInterfaceAnnot : ClassSymbol = requiredClass(" java.lang.FunctionalInterface" )
926
925
@ tu lazy val TargetNameAnnot : ClassSymbol = requiredClass(" scala.annotation.targetName" )
927
926
@ tu lazy val VarargsAnnot : ClassSymbol = requiredClass(" scala.annotation.varargs" )
Original file line number Diff line number Diff line change @@ -168,7 +168,11 @@ object Types {
168
168
case _ : SingletonType | NoPrefix => true
169
169
case tp : RefinedOrRecType => tp.parent.isStable
170
170
case tp : ExprType => tp.resultType.isStable
171
- case tp : AnnotatedType => tp.annot.symbol == defn.StableAnnot || tp.parent.isStable
171
+ case tp : AnnotatedType =>
172
+ // NOTE UncheckedStableAnnot was originally meant to be put on fields,
173
+ // not on types. Allowing it on types is a Scala 3 extension. See:
174
+ // https://www.scala-lang.org/files/archive/spec/2.11/11-annotations.html#scala-compiler-annotations
175
+ tp.annot.symbol == defn.UncheckedStableAnnot || tp.parent.isStable
172
176
case tp : AndType =>
173
177
// TODO: fix And type check when tp contains type parames for explicit-nulls flow-typing
174
178
// see: tests/explicit-nulls/pos/flow-stable.scala.disabled
Original file line number Diff line number Diff line change @@ -3539,7 +3539,7 @@ class Typer extends Namer
3539
3539
// this is needed for -Ycheck. Without the annotation Ycheck will
3540
3540
// skolemize the result type which will lead to different types before
3541
3541
// and after checking. See i11955.scala.
3542
- AnnotatedType (conj, Annotation (defn.StableAnnot ))
3542
+ AnnotatedType (conj, Annotation (defn.UncheckedStableAnnot ))
3543
3543
else conj
3544
3544
else pt
3545
3545
gadts.println(i " insert GADT cast from $tree to $target" )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments