Skip to content

Commit b359c7d

Browse files
committed
Drop BodyOfTransparent mode bit
- premature optimization, we can just inspect the owner chain, - if we need it, it should be an automatically updated cache
1 parent 97f2eec commit b359c7d

File tree

3 files changed

+1
-6
lines changed

3 files changed

+1
-6
lines changed

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

-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,4 @@ object Mode {
9393

9494
/** We are in the IDE */
9595
val Interactive = newMode(20, "Interactive")
96-
97-
/** We are typing the body of a transparent method */
98-
val TransparentBody = newMode(21, "TransparentBody")
9996
}

compiler/src/dotty/tools/dotc/typer/Namer.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -1128,8 +1128,7 @@ class Namer { typer: Typer =>
11281128
// it would be erased to BoxedUnit.
11291129
def dealiasIfUnit(tp: Type) = if (tp.isRef(defn.UnitClass)) defn.UnitType else tp
11301130

1131-
var rhsCtx = ctx.addMode(Mode.InferringReturnType)
1132-
if (sym.isTransparentMethod) rhsCtx = rhsCtx.addMode(Mode.TransparentBody)
1131+
val rhsCtx = ctx.addMode(Mode.InferringReturnType)
11331132
def rhsType = typedAheadExpr(mdef.rhs, inherited orElse rhsProto)(rhsCtx).tpe
11341133

11351134
// Approximate a type `tp` with a type that does not contain skolem types.

compiler/src/dotty/tools/dotc/typer/Typer.scala

-1
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,6 @@ class Typer extends Namer
14281428
(tparams1, sym.owner.typeParams).zipped.foreach ((tdef, tparam) =>
14291429
rhsCtx.gadt.setBounds(tdef.symbol, TypeAlias(tparam.typeRef)))
14301430
}
1431-
if (sym.isTransparentMethod) rhsCtx = rhsCtx.addMode(Mode.TransparentBody)
14321431
val rhs1 = normalizeErasedRhs(typedExpr(ddef.rhs, tpt1.tpe)(rhsCtx), sym)
14331432

14341433
// Overwrite inline body to make sure it is not evaluated twice

0 commit comments

Comments
 (0)