aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/ExpandSAMs.scala
diff options
context:
space:
mode:
authorSébastien Doeraene <sjrdoeraene@gmail.com>2016-03-05 09:51:50 +0100
committerSébastien Doeraene <sjrdoeraene@gmail.com>2016-03-07 16:18:54 +0100
commit4b10e2b7127f3644453a00fe54fec0212614c944 (patch)
treeddc25411d2734004e144d55c9d51231f59d0b795 /src/dotty/tools/dotc/transform/ExpandSAMs.scala
parenta50926701ef5171779aa025d2d307751d166cabe (diff)
downloaddotty-4b10e2b7127f3644453a00fe54fec0212614c944.tar.gz
dotty-4b10e2b7127f3644453a00fe54fec0212614c944.tar.bz2
dotty-4b10e2b7127f3644453a00fe54fec0212614c944.zip
Fix #1146: Fix bug of ExpandSAMs with non-apply SAM methods.
When expanding a SAM, ExpandSAMs always used the name `apply` for the generated forwarder, instead of the name of the method which is abstract in the SAM type. This commit fixes this issue.
Diffstat (limited to 'src/dotty/tools/dotc/transform/ExpandSAMs.scala')
-rw-r--r--src/dotty/tools/dotc/transform/ExpandSAMs.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/ExpandSAMs.scala b/src/dotty/tools/dotc/transform/ExpandSAMs.scala
index 5de778fab..fd556b572 100644
--- a/src/dotty/tools/dotc/transform/ExpandSAMs.scala
+++ b/src/dotty/tools/dotc/transform/ExpandSAMs.scala
@@ -42,8 +42,9 @@ class ExpandSAMs extends MiniPhaseTransform { thisTransformer =>
case tpe @ SAMType(_) if isJvmSam(tpe.classSymbol.asClass) =>
tree
case tpe =>
+ val Seq(samDenot) = tpe.abstractTermMembers.filter(!_.symbol.is(SuperAccessor))
cpy.Block(tree)(stats,
- AnonClass(tpe :: Nil, fn.symbol.asTerm :: Nil, nme.apply :: Nil))
+ AnonClass(tpe :: Nil, fn.symbol.asTerm :: Nil, samDenot.symbol.asTerm.name :: Nil))
}
case _ =>
tree