@@ -129,7 +129,7 @@ class Semantic {
129129 type Heap = Heap .Heap
130130
131131 import Heap ._
132- def heap ( using h : Heap ) : Heap = h
132+ val heap : Heap = Heap .empty
133133
134134 object Promoted {
135135 /** Values that have been safely promoted */
@@ -205,7 +205,7 @@ class Semantic {
205205 }
206206
207207 /** The state that threads through the interpreter */
208- type Contextual [T ] = (Heap , Context , Trace , Promoted ) ?=> T
208+ type Contextual [T ] = (Context , Trace , Promoted ) ?=> T
209209
210210// ----- Error Handling -----------------------------------
211211
@@ -268,7 +268,13 @@ class Semantic {
268268 if obj.fields.contains(target) then
269269 Result (obj.fields(target), Nil )
270270 else if addr.isInstanceOf [Warm ] then
271- if target.hasSource then
271+ if target.is(Flags .ParamAccessor ) then
272+ // possible for trait parameters
273+ // see tests/init/neg/trait2.scala
274+ //
275+ // return `Hot` here, errors are reported in checking `ThisRef`
276+ Result (Hot , Nil )
277+ else if target.hasSource then
272278 val rhs = target.defTree.asInstanceOf [ValOrDefDef ].rhs
273279 eval(rhs, addr, target.owner.asClass, cacheResult = true )
274280 else
@@ -310,7 +316,7 @@ class Semantic {
310316 val cls = target.owner.enclosingClass.asClass
311317 if target.isPrimaryConstructor then
312318 val tpl = cls.defTree.asInstanceOf [TypeDef ].rhs.asInstanceOf [Template ]
313- eval(tpl, addr, cls, cacheResult = true )(using heap, ctx, trace.add(tpl), promoted)
319+ eval(tpl, addr, cls, cacheResult = true )(using ctx, trace.add(tpl), promoted)
314320 else
315321 val rhs = target.defTree.asInstanceOf [ValOrDefDef ].rhs
316322 eval(rhs, addr, cls, cacheResult = true )
@@ -608,11 +614,11 @@ class Semantic {
608614 case Select (supert : Super , _) =>
609615 val SuperType (thisTp, superTp) = supert.tpe
610616 val thisValue2 = resolveThis(thisTp.classSymbol.asClass, thisV, klass, ref)
611- Result (thisValue2, errors).call(ref.symbol, superTp, expr)(using heap, ctx, trace2)
617+ Result (thisValue2, errors).call(ref.symbol, superTp, expr)(using ctx, trace2)
612618
613619 case Select (qual, _) =>
614620 val res = eval(qual, thisV, klass) ++ errors
615- res.call(ref.symbol, superType = NoType , source = expr)(using heap, ctx, trace2)
621+ res.call(ref.symbol, superType = NoType , source = expr)(using ctx, trace2)
616622
617623 case id : Ident =>
618624 id.tpe match
@@ -624,7 +630,7 @@ class Semantic {
624630 thisValue2.call(id.symbol, superType = NoType , expr, needResolve = false )
625631 case TermRef (prefix, _) =>
626632 val res = cases(prefix, thisV, klass, id) ++ errors
627- res.call(id.symbol, superType = NoType , source = expr)(using heap, ctx, trace2)
633+ res.call(id.symbol, superType = NoType , source = expr)(using ctx, trace2)
628634
629635 case Select (qualifier, name) =>
630636 eval(qualifier, thisV, klass).select(expr.symbol, expr)
@@ -816,7 +822,7 @@ class Semantic {
816822
817823 // follow constructor
818824 if cls.hasSource then
819- val res2 = thisV.call(ctor, superType = NoType , source)(using heap, ctx, trace.add(source))
825+ val res2 = thisV.call(ctor, superType = NoType , source)(using ctx, trace.add(source))
820826 errorBuffer ++= res2.errors
821827
822828 // parents
0 commit comments