Skip to content

Commit

Permalink
Remove isTrackableRef check in BiTypeMap.backward
Browse files Browse the repository at this point in the history
  • Loading branch information
bracevac committed Jan 25, 2025
1 parent 81e05a2 commit c806126
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/cc/Setup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
// For example, `(x: T, y: x.f.type) => Unit`. In this case, when we
// substitute `x.f.type`, `x` becomes a `TermParamRef`. But the new method
// type is still under initialization and `paramInfos` is still `null`,
// so the new `NamedType` will not have a denoation.
// so the new `NamedType` will not have a denotation.
def adaptedInfo(psym: Symbol, info: mt.PInfo): mt.PInfo = mt.companion match
case mtc: MethodTypeCompanion => mtc.adaptParamInfo(psym, info).asInstanceOf[mt.PInfo]
case _ => info
Expand Down
15 changes: 2 additions & 13 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6070,22 +6070,11 @@ object Types extends TypeUtils {
def inverse: BiTypeMap

/** A restriction of this map to a function on tracked CaptureRefs */
def forward(ref: CaptureRef): CaptureRef =
val result = this(ref)
/*def ensureTrackable(tp: Type): CaptureRef = tp match
case tp: CaptureRef =>
if tp.isTrackableRef then tp
else ensureTrackable(tp.underlying)
case tp: TypeAlias =>
ensureTrackable(tp.alias)
case _ =>
assert(false, i"not a trackable captureRef ref: $result, ${result.underlyingIterator.toList}")
ensureTrackable(result)*/
result.asInstanceOf[CaptureRef]
def forward(ref: CaptureRef): CaptureRef = this(ref).asInstanceOf[CaptureRef]

/** A restriction of the inverse to a function on tracked CaptureRefs */
def backward(ref: CaptureRef): CaptureRef = inverse(ref) match
case result: CaptureRef if result.isTrackableRef => result
case result: CaptureRef => result
end BiTypeMap

abstract class TypeMap(implicit protected var mapCtx: Context)
Expand Down

0 comments on commit c806126

Please sign in to comment.