diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-09-20 14:03:44 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-09-20 14:03:44 +0000 |
commit | f6d4d84dd7eb5de3e7f698c7f627d483b6999142 (patch) | |
tree | f2ec89f0ab9ce26fb110863e57c86d4fc6110ca7 /src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | |
parent | c22bc18ab6a6b91c30a6e9dde6797d7db94e22e0 (diff) | |
download | scala-f6d4d84dd7eb5de3e7f698c7f627d483b6999142.tar.gz scala-f6d4d84dd7eb5de3e7f698c7f627d483b6999142.tar.bz2 scala-f6d4d84dd7eb5de3e7f698c7f627d483b6999142.zip |
Fixes #4417.
Review by Dragos.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 14bfa65335..89d50f4cc3 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1241,12 +1241,19 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { tree match { case Apply(Select(New(tpt), nme.CONSTRUCTOR), args) => if (findSpec(tpt.tpe).typeSymbol ne tpt.tpe.typeSymbol) { + // the ctor can be specialized log("** instantiated specialized type: " + findSpec(tpt.tpe)) - atPos(tree.pos)( - localTyper.typed( - Apply( - Select(New(TypeTree(findSpec(tpt.tpe))), nme.CONSTRUCTOR), - transformTrees(args)))) + try { + atPos(tree.pos)( + localTyper.typed( + Apply( + Select(New(TypeTree(findSpec(tpt.tpe))), nme.CONSTRUCTOR), + transformTrees(args)))) + } catch { + case te: TypeError => + reporter.error(tree.pos, te.msg) + super.transform(tree) + } } else super.transform(tree) case TypeApply(Select(qual, name), targs) |