Commit 41ac572
committed
SI-9319 Avoid "filename too long" errors for anon functions
Under -Ydelambdafy:method, the name of the anonymous class is
derived from the names of the original enclosing class and
term of the function.
However no effort is made to conform to the `-Xmaxclassname` setting
when constructing the class name from the components.
Recently, in 029cce7, I changed uncurry to selectively fallback
to the old method of emitting lambdas when we detect that
`-Ydelambdafy:method` would subvert specialization.
As a result of this, we could now have a delambdafy translated
function enclosed in an anonymous class representing an old-style
function. If that function, in turn, is heavily nested, its long
name now contributes a long suffix to the delambdafy class's name.
This led to a "filename too long" error in `run/kmpSliceSearch.scala`.
I have extract the essence of the failure in `pos/t9319.scala`.
I then changed delambdafy to use the unexpanded names of the owners
rather than the full name. This makes things work as expected.
I haven't further protected against pathological cases, given
that in 2.12.x and indylambda, we won't ever emit these classes.1 parent 47d89a4 commit 41ac572
File tree
3 files changed
+38
-2
lines changed- src/compiler/scala/tools/nsc/transform
- test/files/pos
3 files changed
+38
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments