File tree 3 files changed +38
-4
lines changed
compiler/src/dotty/tools/dotc/typer
3 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -149,12 +149,26 @@ 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 (enclosingInlineds.nonEmpty) inlined // remove in the outer inlined call
153
+ else {
154
+ val reposition = new TreeMap {
155
+ private [this ] var pos : Position = inlined.pos
156
+ override def transform (tree : Tree )(implicit ctx : Context ): Tree = {
157
+ tree match {
158
+ case inlined : Inlined =>
159
+ val last = pos
160
+ pos = inlined.call.pos
161
+ val res = tpd.seq(inlined.bindings.map(transform), transform(inlined.expansion)).withPos(last)
162
+ pos = last
163
+ res
164
+ case tree =>
165
+ if (pos.exists) super .transform(tree).withPos(pos)
166
+ else super .transform(tree)
167
+ }
168
+ }
155
169
}
170
+ reposition.transform(inlined)
156
171
}
157
- tpd.seq(inlined.bindings, reposition.transform(inlined.expansion))
158
172
}
159
173
}
160
174
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