Skip to content

Commit 6ac0439

Browse files
committed
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.
1 parent d8f17a1 commit 6ac0439

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,6 @@ class Definitions {
304304
@tu lazy val Any_typeCast: TermSymbol = enterT1ParameterlessMethod(AnyClass, nme.asInstanceOfPM, _.paramRefs(0), Final | SyntheticArtifact | StableRealizable)
305305
// generated by pattern matcher and explicit nulls, eliminated by erasure
306306

307-
@tu lazy val Any_ccReach =
308-
newPermanentSymbol(AnyClass, nme.CC_REACH, Final | SyntheticArtifact | StableRealizable,
309-
info = new LazyType:
310-
def complete(denot: SymDenotation)(using Context): Unit =
311-
denot.info = Caps_Cap.typeRef
312-
).entered
313-
// The internal representation of a reach capability `x*` is `x.$reach`.
314-
// See doc comment in CaptureOps.reach for more info on reach capabilities
315-
316307
/** def getClass[A >: this.type](): Class[? <: A] */
317308
@tu lazy val Any_getClass: TermSymbol =
318309
enterPolyMethod(
@@ -321,6 +312,8 @@ class Definitions {
321312
Final,
322313
bounds = TypeBounds.lower(AnyClass.thisType))
323314

315+
@tu lazy val Any_ccReach = enterMethod(AnyClass, nme.CC_REACH, AnyType)
316+
324317
def AnyMethods: List[TermSymbol] = List(Any_==, Any_!=, Any_equals, Any_hashCode,
325318
Any_toString, Any_##, Any_getClass, Any_isInstanceOf, Any_asInstanceOf, Any_typeTest,
326319
Any_typeCast, Any_ccReach)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2910,8 +2910,8 @@ object Types {
29102910
((prefix eq NoPrefix)
29112911
|| symbol.is(ParamAccessor) && (prefix eq symbol.owner.thisType)
29122912
|| isRootCapability
2913-
|| isReach
29142913
) && !symbol.isOneOf(UnstableValueFlags)
2914+
|| isReach
29152915

29162916
override def isReach(using Context): Boolean =
29172917
name == nme.CC_REACH && symbol == defn.Any_ccReach

tests/run-macros/i6518.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
##
33
$asInstanceOf$
44
$isInstanceOf$
5+
$reach
56
==
67
andThen
78
apply

0 commit comments

Comments
 (0)