diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2017-04-04 19:17:42 +0200 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2017-04-04 20:24:35 +0200 |
commit | 6ae376a4544cbf93b94dc0a6ba4a78224e0477df (patch) | |
tree | 444b619989a686f66b74a963d238c318ff847aa2 /compiler/src/dotty/tools/dotc/core/tasty | |
parent | 42c2a6fbbddf73ef2faeb6204c2b7521a76d7345 (diff) | |
download | dotty-6ae376a4544cbf93b94dc0a6ba4a78224e0477df.tar.gz dotty-6ae376a4544cbf93b94dc0a6ba4a78224e0477df.tar.bz2 dotty-6ae376a4544cbf93b94dc0a6ba4a78224e0477df.zip |
checkNoPrivateLeaks: Do not allow types to refer to leaky aliases
`checkNoPrivateLeaks` can force a lot of things, this lead to
hard-to-reproduce issues in unpickling because we called
`checkNoPrivateLeaks` on the type parameters of a class before anything
in the class was indexed. We fix this by making sure that
`checkNoPrivateLeaks` never transforms type symbols, only term symbols,
therefore we can unpickle type parameters without forcing too many
things. tests/neg/leak-type.scala illustrates the new restriction that
this necessitates.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/tasty')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index a9ea49ad1..88b6eef7a 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -736,7 +736,9 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle // no longer necessary. goto(end) setPos(start, tree) - sym.info = ta.avoidPrivateLeaks(sym, tree.pos) + if (!sym.isType) { // Only terms might have leaky aliases, see the documentation of `checkNoPrivateLeaks` + sym.info = ta.avoidPrivateLeaks(sym, tree.pos) + } tree } |