diff options
author | Paul Phillips <paulp@improving.org> | 2012-02-22 20:34:25 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-22 21:41:26 -0800 |
commit | 98cf4014a3a14dbc348a464584133d90719bdbb8 (patch) | |
tree | add010ac2c7ab3e5899e2f19b47dcaa278a3734b /src/compiler | |
parent | 06384c052ec31db4bd094b949bed0f3cb3fb644b (diff) | |
download | scala-98cf4014a3a14dbc348a464584133d90719bdbb8.tar.gz scala-98cf4014a3a14dbc348a464584133d90719bdbb8.tar.bz2 scala-98cf4014a3a14dbc348a464584133d90719bdbb8.zip |
One last nudge for elidable.
A method with return type Nothing elides into a call to ??? .
It's the role ??? was born for.
Diffstat (limited to 'src/compiler')
4 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/reflect/internal/Definitions.scala b/src/compiler/scala/reflect/internal/Definitions.scala index d043230e48..ce5bb3d1c4 100644 --- a/src/compiler/scala/reflect/internal/Definitions.scala +++ b/src/compiler/scala/reflect/internal/Definitions.scala @@ -274,6 +274,7 @@ trait Definitions extends reflect.api.StandardDefinitions { def Predef_identity = getMember(PredefModule, nme.identity) def Predef_conforms = getMember(PredefModule, nme.conforms) def Predef_wrapRefArray = getMember(PredefModule, nme.wrapRefArray) + def Predef_??? = getMember(PredefModule, nme.???) /** Is `sym` a member of Predef with the given name? * Note: DON't replace this by sym == Predef_conforms/etc, as Predef_conforms is a `def` diff --git a/src/compiler/scala/reflect/internal/StdNames.scala b/src/compiler/scala/reflect/internal/StdNames.scala index f61fe7a457..a78e0cc939 100644 --- a/src/compiler/scala/reflect/internal/StdNames.scala +++ b/src/compiler/scala/reflect/internal/StdNames.scala @@ -260,6 +260,8 @@ trait StdNames extends NameManglers { self: SymbolTable => case _ => newTermName("x$" + i) } + val ??? = encode("???") + val wrapRefArray: NameType = "wrapRefArray" val wrapByteArray: NameType = "wrapByteArray" val wrapShortArray: NameType = "wrapShortArray" diff --git a/src/compiler/scala/reflect/internal/TreeGen.scala b/src/compiler/scala/reflect/internal/TreeGen.scala index cc882ad5ed..8c2a067d4d 100644 --- a/src/compiler/scala/reflect/internal/TreeGen.scala +++ b/src/compiler/scala/reflect/internal/TreeGen.scala @@ -250,7 +250,10 @@ abstract class TreeGen { * var x: T = _ * which is appropriate to the given Type. */ - def mkZero(tp: Type): Tree = Literal(mkConstantZero(tp)) setType tp + def mkZero(tp: Type): Tree = tp.typeSymbol match { + case NothingClass => mkMethodCall(Predef_???, Nil) setType NothingClass.tpe + case _ => Literal(mkConstantZero(tp)) setType tp + } def mkConstantZero(tp: Type): Constant = tp.typeSymbol match { case UnitClass => Constant(()) diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 69bf006036..6a7fcc98c3 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -508,7 +508,7 @@ abstract class UnCurry extends InfoTransform // TODO - settings.noassertions.value temporarily retained to avoid // breakage until a reasonable interface is settled upon. if ((sym ne null) && (sym.elisionLevel.exists (_ < settings.elidebelow.value || settings.noassertions.value))) - super.transform(replaceElidableTree(tree)) + replaceElidableTree(tree) else tree match { case dd @ DefDef(mods, name, tparams, vparamss, tpt, rhs) => if (dd.symbol hasAnnotation VarargsClass) saveRepeatedParams(dd) |