@@ -635,7 +635,7 @@ object Objects:
635635 * @param ctor The symbol of the target method.
636636 * @param args Arguments of the constructor call (all parameter blocks flatten to a list).
637637 */
638- def callConstructor (thisV : Value , ctor : Symbol , args : List [ArgInfo ]): Contextual [Value ] = log(" call " + ctor.show + " , args = " + args.map(_.value.show), printer, (_ : Value ).show) {
638+ def callConstructor (thisV : Value , ctor : Symbol , args : List [ArgInfo ]): Contextual [Unit ] = log(" call " + ctor.show + " , args = " + args.map(_.value.show), printer, (_ : Value ).show) {
639639
640640 thisV match
641641 case ref : Ref =>
@@ -648,7 +648,6 @@ object Objects:
648648 if ctor.isPrimaryConstructor then
649649 val tpl = cls.defTree.asInstanceOf [TypeDef ].rhs.asInstanceOf [Template ]
650650 extendTrace(cls.defTree) { eval(tpl, ref, cls, cacheResult = true ) }
651- ref
652651 else
653652 extendTrace(ddef) { eval(ddef.rhs, ref, cls, cacheResult = true ) }
654653 else
@@ -817,6 +816,7 @@ object Objects:
817816 * @param sym The symbol of the variable.
818817 */
819818 def readLocal (thisV : Value , sym : Symbol ): Contextual [Value ] = log(" reading local " + sym.show, printer, (_ : Value ).show) {
819+ def isByNameParam (sym : Symbol ) = sym.is(Flags .Param ) && sym.info.isInstanceOf [ExprType ]
820820 Env .resolveEnv(sym.enclosingMethod, thisV, summon[Env .Data ]) match
821821 case Some (thisV -> env) =>
822822 if sym.is(Flags .Mutable ) then
@@ -837,7 +837,7 @@ object Objects:
837837 try
838838 // Assume forward reference check is doing a good job
839839 val value = Env .valValue(sym)
840- if sym.is( Flags . Param ) && sym.info. isInstanceOf [ ExprType ] then
840+ if isByNameParam( sym) then
841841 value match
842842 case fun : Fun =>
843843 given Env .Data = fun.env
@@ -856,7 +856,7 @@ object Objects:
856856 Bottom
857857
858858 case _ =>
859- if sym.is( Flags . Param ) && sym.info. isInstanceOf [ ExprType ] then
859+ if isByNameParam( sym) then
860860 report.warning(" Calling cold by-name alias. Call trace: \n " + Trace .show, Trace .position)
861861 Bottom
862862 else
@@ -988,7 +988,7 @@ object Objects:
988988 case Select (qual, _) =>
989989 val receiver = eval(qual, thisV, klass)
990990 if ref.symbol.isConstructor then
991- withTrace(trace2) { callConstructor(receiver, ref.symbol, args) }
991+ withTrace(trace2) { callConstructor(receiver, ref.symbol, args); Bottom }
992992 else
993993 withTrace(trace2) { call(receiver, ref.symbol, args, receiver = qual.tpe, superType = NoType ) }
994994
@@ -1003,7 +1003,7 @@ object Objects:
10031003 case TermRef (prefix, _) =>
10041004 val receiver = withTrace(trace2) { evalType(prefix, thisV, klass) }
10051005 if id.symbol.isConstructor then
1006- withTrace(trace2) { callConstructor(receiver, id.symbol, args) }
1006+ withTrace(trace2) { callConstructor(receiver, id.symbol, args); Bottom }
10071007 else
10081008 withTrace(trace2) { call(receiver, id.symbol, args, receiver = prefix, superType = NoType ) }
10091009
@@ -1089,10 +1089,10 @@ object Objects:
10891089 eval(expr, thisV, klass)
10901090
10911091 case Try (block, cases, finalizer) =>
1092- eval (block, thisV, klass)
1092+ val res = evalExprs (block :: cases.map(_.body) , thisV, klass).join
10931093 if ! finalizer.isEmpty then
10941094 eval(finalizer, thisV, klass)
1095- evalExprs(cases.map(_.body), thisV, klass).join
1095+ res
10961096
10971097 case SeqLiteral (elems, elemtpt) =>
10981098 evalExprs(elems, thisV, klass).join
@@ -1259,7 +1259,6 @@ object Objects:
12591259 tasks.append { () =>
12601260 printer.println(" init super class " + cls.show)
12611261 callConstructor(thisV, ctor, args)
1262- ()
12631262 }
12641263
12651264 // parents
0 commit comments