From c37c9f909ff6da1e5e5280cfa80395159aa952a9 Mon Sep 17 00:00:00 2001 From: odersky Date: Mon, 13 Nov 2023 23:44:46 +0100 Subject: [PATCH] Make Any.$reach a method. For some reason, http4s in the CB fails compilation otherwise. It's not clear what the failure has to do with the addition of $reach to Any, but it goes away when $reach has Method flag. --- compiler/src/dotty/tools/dotc/core/Definitions.scala | 11 ++--------- compiler/src/dotty/tools/dotc/core/Types.scala | 2 +- tests/run-macros/i6518.check | 1 + 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index a391c4201df8..0fb938049227 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -304,15 +304,6 @@ class Definitions { @tu lazy val Any_typeCast: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.asInstanceOfPM, _.paramRefs(0), Final | SyntheticArtifact | StableRealizable) // generated by pattern matcher and explicit nulls, eliminated by erasure - @tu lazy val Any_ccReach = - newPermanentSymbol(AnyClass, nme.CC_REACH, Final | SyntheticArtifact | StableRealizable, - info = new LazyType: - def complete(denot: SymDenotation)(using Context): Unit = - denot.info = Caps_Cap.typeRef - ).entered - // The internal representation of a reach capability `x*` is `x.$reach`. - // See doc comment in CaptureOps.reach for more info on reach capabilities - /** def getClass[A >: this.type](): Class[? <: A] */ @tu lazy val Any_getClass: TermSymbol = enterPolyMethod( @@ -321,6 +312,8 @@ class Definitions { Final, bounds = TypeBounds.lower(AnyClass.thisType)) + @tu lazy val Any_ccReach = enterMethod(AnyClass, nme.CC_REACH, AnyType) + def AnyMethods: List[TermSymbol] = List(Any_==, Any_!=, Any_equals, Any_hashCode, Any_toString, Any_##, Any_getClass, Any_isInstanceOf, Any_asInstanceOf, Any_typeTest, Any_typeCast, Any_ccReach) diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index c3d78e37f4e2..c30cbfbace4b 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -2910,8 +2910,8 @@ object Types { ((prefix eq NoPrefix) || symbol.is(ParamAccessor) && (prefix eq symbol.owner.thisType) || isRootCapability - || isReach ) && !symbol.isOneOf(UnstableValueFlags) + || isReach override def isReach(using Context): Boolean = name == nme.CC_REACH && symbol == defn.Any_ccReach diff --git a/tests/run-macros/i6518.check b/tests/run-macros/i6518.check index 388ef88a5170..01dddc3f3246 100644 --- a/tests/run-macros/i6518.check +++ b/tests/run-macros/i6518.check @@ -2,6 +2,7 @@ ## $asInstanceOf$ $isInstanceOf$ +$reach == andThen apply