Skip to content

Commit 962fb94

Browse files
committed
Simplify Warm.call and Warm.select
1 parent 44031b8 commit 962fb94

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

compiler/src/dotty/tools/dotc/transform/init/Semantic.scala

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ class Semantic {
166166

167167
case warm: Warm =>
168168
val target = resolve(warm.klass, field)
169-
if target.is(Flags.Lazy) then value.call(target, superType = NoType, source)
170-
else if target.hasSource then
171-
val rhs = target.defTree.asInstanceOf[ValDef].rhs
169+
if target.hasSource then
170+
val rhs = target.defTree.asInstanceOf[ValOrDefDef].rhs
172171
eval(rhs, warm, target.owner.asClass, cacheResult = true)
173172
else
174173
val error = CallUnknown(field, source, trace)
@@ -204,7 +203,7 @@ class Semantic {
204203
init(target.owner.asClass, thisRef)
205204
else if target.isOneOf(Flags.Method | Flags.Lazy) then
206205
if target.hasSource then
207-
val rhs = target.defTree.asInstanceOf[DefDef].rhs
206+
val rhs = target.defTree.asInstanceOf[ValOrDefDef].rhs
208207
eval(rhs, thisRef, target.owner.asClass, cacheResult = true)
209208
else
210209
val error = CallUnknown(target, source, trace)
@@ -222,15 +221,8 @@ class Semantic {
222221
resolveSuper(warm.klass, superType.classSymbol.asClass, meth)
223222
else
224223
resolve(warm.klass, meth)
225-
if target.isOneOf(Flags.Method | Flags.Lazy) then
226-
if target.hasSource then
227-
val rhs = target.defTree.asInstanceOf[DefDef].rhs
228-
eval(rhs, warm, target.owner.asClass, cacheResult = true)
229-
else
230-
val error = CallUnknown(target, source, trace)
231-
Result(Hot, error :: Nil)
232-
else if target.hasSource then
233-
val rhs = target.defTree.asInstanceOf[ValDef].rhs
224+
if target.hasSource then
225+
val rhs = target.defTree.asInstanceOf[ValOrDefDef].rhs
234226
eval(rhs, warm, target.owner.asClass, cacheResult = true)
235227
else
236228
val error = CallUnknown(target, source, trace)

0 commit comments

Comments
 (0)