@@ -329,8 +329,9 @@ class Semantic {
329329 def widen : List [Value ] = values.map(_.widen).toList
330330
331331 extension (value : Value )
332- def select (field : Symbol , source : Tree , needResolve : Boolean = true ): Contextual [Result ] =
333- value match {
332+ def select (field : Symbol , source : Tree , needResolve : Boolean = true ): Contextual [Result ] = log(" select " + field.show, printer, res => res.asInstanceOf [Result ].show) {
333+ if promoted.isCurrentObjectPromoted then Result (Hot , Nil )
334+ else value match {
334335 case Hot =>
335336 Result (Hot , Errors .empty)
336337
@@ -376,14 +377,14 @@ class Semantic {
376377 val errors = resList.flatMap(_.errors)
377378 Result (value2, errors)
378379 }
380+ }
379381
380- def call (meth : Symbol , args : List [Value ], superType : Type , source : Tree , needResolve : Boolean = true ): Contextual [Result ] =
382+ def call (meth : Symbol , args : List [Value ], superType : Type , source : Tree , needResolve : Boolean = true ): Contextual [Result ] = log( " call " + meth.show + " , args = " + args, printer, res => res. asInstanceOf [ Result ].show) {
381383 def checkArgs = args.flatMap { arg => arg.promote(" May only use initialized value as arguments" , arg.source) }
382384
383385 // fast track if the current object is already initialized
384- if promoted.isCurrentObjectPromoted then return Result (Hot , Nil )
385-
386- value match {
386+ if promoted.isCurrentObjectPromoted then Result (Hot , Nil )
387+ else value match {
387388 case Hot =>
388389 Result (Hot , checkArgs)
389390
@@ -447,11 +448,13 @@ class Semantic {
447448 val errors = resList.flatMap(_.errors)
448449 Result (value2, errors)
449450 }
451+ }
450452
451453 /** Handle a new expression `new p.C` where `p` is abstracted by `value` */
452- def instantiate (klass : ClassSymbol , ctor : Symbol , args : List [Value ], source : Tree ): Contextual [Result ] =
454+ def instantiate (klass : ClassSymbol , ctor : Symbol , args : List [Value ], source : Tree ): Contextual [Result ] = log( " instantiating " + klass.show + " , args = " + args, printer, res => res. asInstanceOf [ Result ].show) {
453455 val trace1 = trace.add(source)
454- value match {
456+ if promoted.isCurrentObjectPromoted then Result (Hot , Nil )
457+ else value match {
455458 case Hot =>
456459 val buffer = new mutable.ArrayBuffer [Error ]
457460 val args2 = args.map { arg =>
@@ -503,6 +506,7 @@ class Semantic {
503506 val errors = resList.flatMap(_.errors)
504507 Result (value2, errors)
505508 }
509+ }
506510 end extension
507511
508512// ----- Promotion ----------------------------------------------------
0 commit comments