File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,7 @@ class Semantic {
376
376
Result (Hot , error :: Nil )
377
377
378
378
case addr : Addr =>
379
+ val isLocal = meth.owner.isClass
379
380
val target =
380
381
if ! needResolve then
381
382
meth
@@ -389,12 +390,20 @@ class Semantic {
389
390
if target.hasSource then
390
391
given Trace = trace1
391
392
val cls = target.owner.enclosingClass.asClass
393
+ val ddef = target.defTree.asInstanceOf [DefDef ]
394
+ val env2 = Env (ddef, args.widen)
392
395
if target.isPrimaryConstructor then
396
+ given Env = env2
393
397
val tpl = cls.defTree.asInstanceOf [TypeDef ].rhs.asInstanceOf [Template ]
394
398
eval(tpl, addr, cls, cacheResult = true )
399
+ else if target.isConstructor then
400
+ given Env = env2
401
+ eval(ddef.rhs, addr, cls, cacheResult = true )
395
402
else
396
- val rhs = target.defTree.asInstanceOf [ValOrDefDef ].rhs
397
- eval(rhs, addr, cls, cacheResult = true )
403
+ val errors = args.flatMap { arg => arg.promote(" May only use initialized value as arguments" , arg.source) }
404
+ use(Env .empty) {
405
+ eval(ddef.rhs, addr, cls, cacheResult = true )
406
+ }
398
407
else if addr.canIgnoreMethodCall(target) then
399
408
Result (Hot , Nil )
400
409
else
You can’t perform that action at this time.
0 commit comments