Skip to content

Commit c6f7c74

Browse files
committed
Special case experimental in Predef additions
1 parent 4a103c7 commit c6f7c74

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -1461,6 +1461,8 @@ class Definitions {
14611461
makeNonClassSymbol(patch)
14621462
end match
14631463
sym.annotations = patch.annotations
1464+
if experimentalInPredef.contains(patch.name) then
1465+
sym.addAnnotation(Annotations.ExperimentalAnnotation("", sym.span))
14641466
scope.enter(sym)
14651467
if patch.isClass then
14661468
patch2(scope.lookup(patch.name).asClass, patch)
@@ -1477,6 +1479,12 @@ class Definitions {
14771479
patchWith(LanguageModuleClassPatch)
14781480
end patchStdLibClass
14791481

1482+
/** Definitions that are assumed to be experimental in Predef.
1483+
* We can't mark them with @experimental since that causes a cycle.
1484+
* So we add the annotation instead when we patch Predef.
1485+
*/
1486+
private val experimentalInPredef: Set[Name] = Set("is".toTermName)
1487+
14801488
// ----- Symbol sets ---------------------------------------------------
14811489

14821490
@tu lazy val topClasses: Set[Symbol] = Set(AnyClass, MatchableClass, ObjectClass, AnyValClass)

library/src/scala/runtime/stdLibPatches/Predef.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ object Predef:
7272
* TC { type Self = A }
7373
*
7474
* which is what is needed for a context bound `[A: TC]`.
75+
*
76+
* @experimental added by compiler in Definitions.patchStdLibClass
7577
*/
76-
@experimental
7778
infix type is[A <: AnyKind, B <: Any{type Self <: AnyKind}] = B { type Self = A }
7879

7980
end Predef

0 commit comments

Comments
 (0)