File tree Expand file tree Collapse file tree 4 files changed +6
-9
lines changed
compiler/src/dotty/tools/dotc
library/src/scala/annotation/internal Expand file tree Collapse file tree 4 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -921,7 +921,6 @@ class Definitions {
921921 @ tu lazy val ParamMetaAnnot : ClassSymbol = requiredClass(" scala.annotation.meta.param" )
922922 @ tu lazy val SetterMetaAnnot : ClassSymbol = requiredClass(" scala.annotation.meta.setter" )
923923 @ tu lazy val ShowAsInfixAnnot : ClassSymbol = requiredClass(" scala.annotation.showAsInfix" )
924- @ tu lazy val StableAnnot : ClassSymbol = requiredClass(" scala.annotation.internal.Stable" )
925924 @ tu lazy val FunctionalInterfaceAnnot : ClassSymbol = requiredClass(" java.lang.FunctionalInterface" )
926925 @ tu lazy val TargetNameAnnot : ClassSymbol = requiredClass(" scala.annotation.targetName" )
927926 @ 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 {
168168 case _ : SingletonType | NoPrefix => true
169169 case tp : RefinedOrRecType => tp.parent.isStable
170170 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
172176 case tp : AndType =>
173177 // TODO: fix And type check when tp contains type parames for explicit-nulls flow-typing
174178 // 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
35393539 // this is needed for -Ycheck. Without the annotation Ycheck will
35403540 // skolemize the result type which will lead to different types before
35413541 // and after checking. See i11955.scala.
3542- AnnotatedType (conj, Annotation (defn.StableAnnot ))
3542+ AnnotatedType (conj, Annotation (defn.UncheckedStableAnnot ))
35433543 else conj
35443544 else pt
35453545 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