@@ -94,13 +94,9 @@ class Objects {
94
94
params.zip(args).toMap
95
95
96
96
extension (env : Env )
97
- def lookup (sym : Symbol )(using Context ): Value =
98
- if sym.info <:< defn.StringType
99
- || sym.info.classSymbol.isPrimitiveValueClass
100
- then
101
- Bottom
102
- else
103
- env(sym)
97
+ def lookup (sym : Symbol )(using Context ): Value = env(sym)
98
+
99
+ def getOrElse (sym : Symbol , default : Value )(using Context ): Value = env.getOrElse(sym, default)
104
100
105
101
def union (other : Env ): Env = env ++ other
106
102
}
@@ -311,14 +307,14 @@ class Objects {
311
307
}
312
308
313
309
def call (meth : Symbol , args : List [Value ], superType : Type , source : Tree , needResolve : Boolean = true ): Contextual [Result ] =
314
- val isLocal = meth.owner.isClass
315
310
value match {
316
311
case Bottom =>
317
312
Result (Bottom , Errors .empty)
318
313
319
314
case TypeAbs (tp) =>
320
315
if meth.isEffectivelyFinal then
321
316
if meth.hasSource then
317
+ val isLocal = meth.owner.isClass
322
318
val ddef = meth.defTree.asInstanceOf [DefDef ]
323
319
val env2 = Env (ddef, args)
324
320
use(if isLocal then env.union(env2) else env2) {
@@ -333,6 +329,7 @@ class Objects {
333
329
Result (Bottom , error :: Nil )
334
330
335
331
case ClassAbs (klass) =>
332
+ val isLocal = meth.owner.isClass
336
333
val target =
337
334
if ! needResolve then
338
335
meth
@@ -359,6 +356,7 @@ class Objects {
359
356
value.select(target, source, needResolve = false )
360
357
361
358
case addr : Addr =>
359
+ val isLocal = meth.owner.isClass
362
360
val target =
363
361
if ! needResolve then
364
362
meth
@@ -717,8 +715,7 @@ class Objects {
717
715
// - look up parameters from environment
718
716
// - evaluate the rhs of the local definition for val definitions: they are already cached
719
717
val sym = tmref.symbol
720
- if sym.is(Flags .Param ) then Result (env.lookup(sym), Nil )
721
- else if sym.info <:< defn.StringType || sym.info.classSymbol.isPrimitiveValueClass then Result (Bottom , Nil )
718
+ if sym.is(Flags .Param ) then Result (env.getOrElse(sym, TypeAbs (sym.info)), Nil )
722
719
else if sym.is(Flags .Mutable ) then Result (TypeAbs (sym.info), Nil )
723
720
else if sym.is(Flags .Package ) then Result (Bottom , Nil )
724
721
else if sym.hasSource then
0 commit comments