File tree 4 files changed +33
-4
lines changed
compiler/src/dotty/tools/dotc 4 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -592,6 +592,8 @@ object Trees {
592
592
extends Tree [T ] {
593
593
type ThisTree [- T >: Untyped ] = Inlined [T ]
594
594
override def initialPos = call.pos
595
+ /** Is this an argument inlined in an inlined function call */
596
+ def isInlinedArgument : Boolean = call.isEmpty
595
597
}
596
598
597
599
/** A type tree that represents an existing or inferred type */
Original file line number Diff line number Diff line change @@ -149,12 +149,19 @@ object Inliner {
149
149
150
150
/** Replace `Inlined` node by a block that contains its bindings and expansion */
151
151
def dropInlined (inlined : tpd.Inlined )(implicit ctx : Context ): Tree = {
152
- val reposition = new TreeMap {
153
- override def transform (tree : Tree )(implicit ctx : Context ): Tree = {
154
- super .transform(tree).withPos(inlined.call.pos)
152
+ if (inlined.isInlinedArgument) inlined // remove in the outer inlined call
153
+ else {
154
+ val reposition = new TreeMap {
155
+ override def transform (tree : Tree )(implicit ctx : Context ): Tree = tree match {
156
+ case inlined : Inlined =>
157
+ // Stop changing positions as this tree already has the correct positions
158
+ assert(inlined.isInlinedArgument)
159
+ tpd.seq(inlined.bindings, inlined.expansion)
160
+ case tree => super .transform(tree).withPos(inlined.call.pos)
161
+ }
155
162
}
163
+ tpd.seq(inlined.bindings, reposition.transform(inlined.expansion))
156
164
}
157
- tpd.seq(inlined.bindings, reposition.transform(inlined.expansion))
158
165
}
159
166
}
160
167
Original file line number Diff line number Diff line change
1
+ failed
2
+ Test$.main(i4947.scala:9)
Original file line number Diff line number Diff line change
1
+ object Test {
2
+
3
+ transparent def track [T ](f : => T ): T = f
4
+
5
+ def main (args : Array [String ]): Unit = {
6
+ try {
7
+ track {
8
+ val a = 9
9
+ throw new Exception (" failed" )
10
+ }
11
+ } catch {
12
+ case ex : Throwable =>
13
+ println(ex.getMessage)
14
+ println(ex.getStackTrace.head)
15
+ }
16
+ }
17
+
18
+ }
You can’t perform that action at this time.
0 commit comments