diff options
author | Martin Odersky <odersky@gmail.com> | 2015-09-16 18:55:05 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-09-16 18:55:05 +0200 |
commit | 7ee013745699029830a822d0b9e1e8862eaa0b8c (patch) | |
tree | f6e26e6cfb84d7cdfe04c49ef32ff09ca3cd686e | |
parent | 99d397d7a02a2ad3aed07e8c48a60bd32564ea62 (diff) | |
download | dotty-7ee013745699029830a822d0b9e1e8862eaa0b8c.tar.gz dotty-7ee013745699029830a822d0b9e1e8862eaa0b8c.tar.bz2 dotty-7ee013745699029830a822d0b9e1e8862eaa0b8c.zip |
Fix weaker access error when generating bridges
A bridge cannot have weaker access than the symbol it overrides.
This triggered an assertion error on "clone" for pos/t2183.scala.
-rw-r--r-- | src/dotty/tools/dotc/transform/Erasure.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/Erasure.scala b/src/dotty/tools/dotc/transform/Erasure.scala index 8b4c6a87d..b1c896997 100644 --- a/src/dotty/tools/dotc/transform/Erasure.scala +++ b/src/dotty/tools/dotc/transform/Erasure.scala @@ -625,8 +625,10 @@ object Erasure extends TypeTestsCasts{ assert(false, s"failure creating bridge from ${newDefSym} to ${parentSym}, reason: $reason") ??? } + var excluded = NoBridgeFlags + if (!newDefSym.is(Flags.Protected)) excluded |= Flags.Protected // needed to avoid "weaker access" assertion failures in expandPrivate val bridge = ctx.newSymbol(currentClass, - parentSym.name, parentSym.flags &~ NoBridgeFlags | Flags.Bridge, parentSym.info, coord = newDefSym.owner.coord).asTerm + parentSym.name, parentSym.flags &~ excluded | Flags.Bridge, parentSym.info, coord = newDefSym.owner.coord).asTerm bridge.enteredAfter(ctx.phase.prev.asInstanceOf[DenotTransformer]) // this should be safe, as we're executing in context of next phase ctx.debuglog(s"generating bridge from ${newDefSym} to $bridge") |