diff options
author | Martin Odersky <odersky@gmail.com> | 2016-08-16 18:34:36 +0200 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2016-08-20 20:31:13 -0700 |
commit | e5315cce416c665d7c6d2740d171343829b30f4c (patch) | |
tree | 95a6c77e958a0cdc779e02408c6848d36254b9f4 /src/dotty/tools/dotc/transform/Mixin.scala | |
parent | 5a5f9d7ed37ca6449ef61ee5e0f6fbf9731df795 (diff) | |
download | dotty-e5315cce416c665d7c6d2740d171343829b30f4c.tar.gz dotty-e5315cce416c665d7c6d2740d171343829b30f4c.tar.bz2 dotty-e5315cce416c665d7c6d2740d171343829b30f4c.zip |
Fix #1444: Add implicit arguments to supertraits
If a super trait is given as a type (i.e. no argument list), implicit args were
not passed. This is fixed now. Also, we now check for parameterized traits lacking
type arguments in Typer instead of in Mixin.
Fixes #1444.
Diffstat (limited to 'src/dotty/tools/dotc/transform/Mixin.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/Mixin.scala | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/transform/Mixin.scala b/src/dotty/tools/dotc/transform/Mixin.scala index 8cdc82f7a..27cfc835a 100644 --- a/src/dotty/tools/dotc/transform/Mixin.scala +++ b/src/dotty/tools/dotc/transform/Mixin.scala @@ -189,16 +189,17 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform => var argNum = 0 def nextArgument() = initArgs.get(mixin) match { case Some(arguments) => - try arguments(argNum) finally argNum += 1 + val result = arguments(argNum) + argNum += 1 + result case None => - val (msg, pos) = impl.parents.find(_.tpe.typeSymbol == mixin) match { - case Some(parent) => ("lacks argument list", parent.pos) - case None => - ("""is indirectly implemented, - |needs to be implemented directly so that arguments can be passed""".stripMargin, - cls.pos) - } - ctx.error(i"parameterized $mixin $msg", pos) + assert( + impl.parents.forall(_.tpe.typeSymbol != mixin), + i"missing parameters for $mixin from $impl should have been caught in typer") + ctx.error( + em"""parameterized $mixin is indirectly implemented, + |needs to be implemented directly so that arguments can be passed""", + cls.pos) EmptyTree } |