Skip to content

Commit 83ab627

Browse files
authored
Merge pull request #12410 from dotty-staging/remove-stable-annot
Replace @stable with @uncheckedStable
2 parents ba6cb92 + 06d8e8e commit 83ab627

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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")

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff 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

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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")

library/src/scala/annotation/internal/Stable.scala

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)