Skip to content

Replace @Stable with @uncheckedStable #12410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,6 @@ class Definitions {
@tu lazy val ParamMetaAnnot: ClassSymbol = requiredClass("scala.annotation.meta.param")
@tu lazy val SetterMetaAnnot: ClassSymbol = requiredClass("scala.annotation.meta.setter")
@tu lazy val ShowAsInfixAnnot: ClassSymbol = requiredClass("scala.annotation.showAsInfix")
@tu lazy val StableAnnot: ClassSymbol = requiredClass("scala.annotation.internal.Stable")
@tu lazy val FunctionalInterfaceAnnot: ClassSymbol = requiredClass("java.lang.FunctionalInterface")
@tu lazy val TargetNameAnnot: ClassSymbol = requiredClass("scala.annotation.targetName")
@tu lazy val VarargsAnnot: ClassSymbol = requiredClass("scala.annotation.varargs")
Expand Down
6 changes: 5 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ object Types {
case _: SingletonType | NoPrefix => true
case tp: RefinedOrRecType => tp.parent.isStable
case tp: ExprType => tp.resultType.isStable
case tp: AnnotatedType => tp.annot.symbol == defn.StableAnnot || tp.parent.isStable
case tp: AnnotatedType =>
// NOTE UncheckedStableAnnot was originally meant to be put on fields,
// not on types. Allowing it on types is a Scala 3 extension. See:
// https://www.scala-lang.org/files/archive/spec/2.11/11-annotations.html#scala-compiler-annotations
tp.annot.symbol == defn.UncheckedStableAnnot || tp.parent.isStable
case tp: AndType =>
// TODO: fix And type check when tp contains type parames for explicit-nulls flow-typing
// see: tests/explicit-nulls/pos/flow-stable.scala.disabled
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3539,7 +3539,7 @@ class Typer extends Namer
// this is needed for -Ycheck. Without the annotation Ycheck will
// skolemize the result type which will lead to different types before
// and after checking. See i11955.scala.
AnnotatedType(conj, Annotation(defn.StableAnnot))
AnnotatedType(conj, Annotation(defn.UncheckedStableAnnot))
else conj
else pt
gadts.println(i"insert GADT cast from $tree to $target")
Expand Down
6 changes: 0 additions & 6 deletions library/src/scala/annotation/internal/Stable.scala

This file was deleted.