@@ -898,7 +898,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
898
898
def cast (tp : Type )(implicit ctx : Context ): Tree = {
899
899
assert(tp.isValueType, i " bad cast: $tree.asInstanceOf[ $tp] " )
900
900
tree.select(if (ctx.erasedTypes) defn.Any_asInstanceOf else defn.Any_typeCast )
901
- .appliedToType(tp)
901
+ .appliedToType(tp).withSpan(tree.span)
902
902
}
903
903
904
904
/** cast `tree` to `tp` (or its box/unbox/cast equivalent when after
@@ -908,7 +908,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
908
908
def ensureConforms (tp : Type )(implicit ctx : Context ): Tree =
909
909
if (tree.tpe <:< tp) tree
910
910
else if (! ctx.erasedTypes) cast(tp)
911
- else Erasure .Boxing .adaptToType(tree, tp)
911
+ else Erasure .Boxing .adaptToType(tree, tp).withSpan(tree.span)
912
912
913
913
/** `tree ne null` (might need a cast to be type correct) */
914
914
def testNotNull (implicit ctx : Context ): Tree = {
@@ -918,7 +918,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
918
918
Typed (tree, TypeTree (defn.AnyRefType ))
919
919
}
920
920
else tree.ensureConforms(defn.ObjectType )
921
- receiver.select(defn.Object_ne ).appliedTo(nullLiteral)
921
+ receiver.select(defn.Object_ne ).appliedTo(nullLiteral).withSpan(tree.span)
922
922
}
923
923
924
924
/** If inititializer tree is `_', the default value of its type,
@@ -929,11 +929,11 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
929
929
930
930
/** `this && that`, for boolean trees `this`, `that` */
931
931
def and (that : Tree )(implicit ctx : Context ): Tree =
932
- tree.select(defn.Boolean_&& ).appliedTo(that)
932
+ tree.select(defn.Boolean_&& ).appliedTo(that).withSpan(tree.span)
933
933
934
934
/** `this || that`, for boolean trees `this`, `that` */
935
935
def or (that : Tree )(implicit ctx : Context ): Tree =
936
- tree.select(defn.Boolean_|| ).appliedTo(that)
936
+ tree.select(defn.Boolean_|| ).appliedTo(that).withSpan(tree.span)
937
937
938
938
/** The translation of `tree = rhs`.
939
939
* This is either the tree as an assignment, or a setter call.
0 commit comments