Skip to content

Commit 0af900a

Browse files
committed
Handle exception
1 parent 0faa404 commit 0af900a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,16 @@ class Checker extends MiniPhase {
4949
import semantic._
5050
val tpl = tree.rhs.asInstanceOf[Template]
5151
val thisRef = ThisRef(cls)
52+
5253
val obj = Objekt(cls, fields = mutable.Map.empty, outers = mutable.Map(cls -> Hot))
54+
heap.update(thisRef, obj)
55+
56+
val paramValues = tpl.constr.termParamss.flatten.map(param => param.symbol -> Hot).toMap
57+
5358
given Promoted = Promoted.empty
5459
given Trace = Trace.empty
55-
given Env = Env.empty
56-
heap.update(thisRef, obj)
60+
given Env = Env(paramValues)
61+
5762
val res = eval(tpl, thisRef, cls)
5863
res.errors.foreach(_.issue)
5964
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class Semantic {
7373

7474
def withSource(source: Tree): Value =
7575
if mySource.isEmpty then attachSource(source)
76+
else if this == Hot || this == Cold then this
7677
else {
7778
val value2 = this.clone.asInstanceOf[Value]
7879
value2.mySource = source

0 commit comments

Comments
 (0)