@@ -1054,19 +1054,18 @@ object Semantic {
1054
1054
exprs.map { expr => eval(expr, thisV, klass) }
1055
1055
1056
1056
/** Evaluate arguments of methods */
1057
- def evalArgs (args : List [Arg ], thisV : Ref , klass : ClassSymbol ): Contextual [(List [Error ], List [ArgInfo ])] =
1057
+ def evalArgs (args : List [Tree ], thisV : Ref , klass : ClassSymbol ): Contextual [(List [Error ], List [ArgInfo ])] =
1058
1058
val errors = new mutable.ArrayBuffer [Error ]
1059
1059
val argInfos = new mutable.ArrayBuffer [ArgInfo ]
1060
1060
args.foreach { arg =>
1061
- val res =
1062
- if arg.isByName then
1063
- val fun = Fun (arg.tree , thisV, klass, env)
1061
+ val res = arg match
1062
+ case ByName (_) =>
1063
+ val fun = Fun (arg, thisV, klass, env)
1064
1064
Result (fun, Nil )
1065
- else
1066
- eval(arg.tree, thisV, klass)
1067
-
1065
+ case _ =>
1066
+ eval(arg, thisV, klass)
1068
1067
errors ++= res.errors
1069
- argInfos += ArgInfo (res.value, arg.tree )
1068
+ argInfos += ArgInfo (res.value, arg)
1070
1069
}
1071
1070
(errors.toList, argInfos.toList)
1072
1071
@@ -1491,31 +1490,17 @@ object Semantic {
1491
1490
case hklambda : HKTypeLambda => typeRefOf(hklambda.resType)
1492
1491
}
1493
1492
1494
- opaque type Arg = Tree | ByNameArg // ^^^ can be simplified
1495
- case class ByNameArg (tree : Tree )
1496
-
1497
- extension (arg : Arg )
1498
- def isByName = arg.isInstanceOf [ByNameArg ]
1499
- def tree : Tree = arg match
1500
- case t : Tree => t
1501
- case ByNameArg (t) => t
1502
-
1503
1493
object Call {
1504
1494
1505
1495
private def isDelayed (tp : Type )(using Context ) =
1506
1496
tp.isInstanceOf [MethodicType ] || tp.isByName
1507
1497
1508
- def unapply (tree : Tree )(using Context ): Option [(Tree , List [List [Arg ]])] =
1498
+ def unapply (tree : Tree )(using Context ): Option [(Tree , List [List [Tree ]])] =
1509
1499
tree match
1510
1500
case Apply (fn, args) =>
1511
- val argTps = fn.tpe.widen match
1512
- case mt : MethodType => mt.paramInfos
1513
- val normArgs : List [Arg ] = args.zip(argTps).map { (arg, formal) =>
1514
- if formal.isByName then ByNameArg (arg.dropByName) else arg
1515
- }
1516
1501
unapply(fn) match
1517
- case Some ((ref, args0)) => Some ((ref, args0 :+ normArgs ))
1518
- case None => None
1502
+ case Some ((ref, args0)) => Some ((ref, args0 :+ args ))
1503
+ case None => None
1519
1504
1520
1505
case TypeApply (fn, targs) =>
1521
1506
unapply(fn)
@@ -1527,7 +1512,7 @@ object Semantic {
1527
1512
}
1528
1513
1529
1514
object NewExpr {
1530
- def unapply (tree : Tree )(using Context ): Option [(TypeRef , New , Symbol , List [List [Arg ]])] =
1515
+ def unapply (tree : Tree )(using Context ): Option [(TypeRef , New , Symbol , List [List [Tree ]])] =
1531
1516
tree match
1532
1517
case Call (fn @ Select (newTree : New , init), argss) if init == nme.CONSTRUCTOR =>
1533
1518
val tref = typeRefOf(newTree.tpe)
0 commit comments