Skip to content

Commit 7f3bebd

Browse files
committed
Handle missing source code
1 parent a748193 commit 7f3bebd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ class Objects {
263263

264264
case ClassAbs(klass) =>
265265
val target = if needResolve then resolve(klass, field) else field
266+
if !target.hasSource then return Result(Bottom, Nil)
267+
266268
val trace1 = trace.add(source)
267269
if target.is(Flags.Lazy) then
268270
given Trace = trace1
@@ -274,6 +276,8 @@ class Objects {
274276

275277
case addr: Addr =>
276278
val target = if needResolve then resolve(addr.klass, field) else field
279+
if !target.hasSource then return Result(Bottom, Nil)
280+
277281
val trace1 = trace.add(source)
278282
if target.is(Flags.Lazy) then
279283
given Trace = trace1
@@ -290,11 +294,9 @@ class Objects {
290294
//
291295
// return `Bottom` here, errors are reported in checking `ThisRef`
292296
Result(Bottom, Nil)
293-
else if target.hasSource then
297+
else
294298
val rhs = target.defTree.asInstanceOf[ValOrDefDef].rhs
295299
eval(rhs, addr, target.owner.asClass, cacheResult = true)
296-
else
297-
Result(Bottom, Nil)
298300

299301
case _: Fun =>
300302
???

0 commit comments

Comments
 (0)