@@ -3806,7 +3806,8 @@ trait Typers extends Modes with Adaptations with Tags {
3806
3806
case AssignOrNamedArg (Ident (name), rhs) => gen.mkTuple(List (CODE .LIT (name.toString), rhs))
3807
3807
case _ => gen.mkTuple(List (CODE .LIT (" " ), arg))
3808
3808
}
3809
- typed(treeCopy.Apply (orig, fun, args map argToBinding), mode, pt)
3809
+ val t = treeCopy.Apply (orig, fun, args map argToBinding)
3810
+ wrapErrors(t, _.typed(t, mode, pt))
3810
3811
}
3811
3812
3812
3813
/** Translate selection that does not typecheck according to the normal rules into a selectDynamic/applyDynamic.
@@ -3874,6 +3875,13 @@ trait Typers extends Modes with Adaptations with Tags {
3874
3875
atPos(qual.pos)(Apply (tappSel, List (Literal (Constant (name.decode)))))
3875
3876
}
3876
3877
}
3878
+
3879
+ def wrapErrors (tree : Tree , typeTree : Typer => Tree ): Tree = {
3880
+ silent(typeTree) match {
3881
+ case SilentResultValue (r) => r
3882
+ case SilentTypeError (err) => DynamicRewriteError (tree, err)
3883
+ }
3884
+ }
3877
3885
}
3878
3886
3879
3887
@ inline final def deindentTyping () = context.typingIndentLevel -= 2
@@ -4067,7 +4075,8 @@ trait Typers extends Modes with Adaptations with Tags {
4067
4075
}
4068
4076
else if (dyna.isDynamicallyUpdatable(lhs1)) {
4069
4077
val rhs1 = typed(rhs, EXPRmode | BYVALmode , WildcardType )
4070
- typed1(Apply (lhs1, List (rhs1)), mode, pt)
4078
+ val t = Apply (lhs1, List (rhs1))
4079
+ dyna.wrapErrors(t, _.typed1(t, mode, pt))
4071
4080
}
4072
4081
else fail()
4073
4082
}
@@ -4535,7 +4544,9 @@ trait Typers extends Modes with Adaptations with Tags {
4535
4544
* @return ...
4536
4545
*/
4537
4546
def typedSelect (tree : Tree , qual : Tree , name : Name ): Tree = {
4538
- def asDynamicCall = dyna.mkInvoke(context.tree, tree, qual, name) map (typed1(_, mode, pt))
4547
+ def asDynamicCall = dyna.mkInvoke(context.tree, tree, qual, name) map { t =>
4548
+ dyna.wrapErrors(t, (_.typed1(t, mode, pt)))
4549
+ }
4539
4550
4540
4551
val sym = tree.symbol orElse member(qual, name) orElse {
4541
4552
// symbol not found? --> try to convert implicitly to a type that does have the required
0 commit comments