summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/package.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-09 12:18:50 -0800
committerPaul Phillips <paulp@improving.org>2013-01-09 12:28:57 -0800
commit198d5229967367493960a6b4e0f9c382d7122a25 (patch)
tree98dd0c2cfe624baae0534b0d9926292b2cff4e18 /src/compiler/scala/tools/nsc/package.scala
parent816bcdf382ea0469f6c5eadcff44901921ba6075 (diff)
downloadscala-198d5229967367493960a6b4e0f9c382d7122a25.tar.gz
scala-198d5229967367493960a6b4e0f9c382d7122a25.tar.bz2
scala-198d5229967367493960a6b4e0f9c382d7122a25.zip
Made "mode" into a value class.
This is an obvious place to apply value class goodness and collect some safety/sanity in typing modes. It does show off a challenge in introducing value classes without disruption: there's no way to deprecate the old signature of 'typed', 'adapt', etc. because they erase the same. class Bippy(val x: Int) extends AnyVal class A { @deprecated("Use a bippy") def f(x: Int): Int = 5 def f(x: Bippy): Int = x.x } ./a.scala:5: error: double definition: method f:(x: Bippy)Int and method f:(x: Int)Int at line 4 have same type after erasure: (x: Int)Int An Int => Mode implicit handles most uses, but nothing can be done to avoid breaking anything which e.g. extends Typer and overrides typed.
Diffstat (limited to 'src/compiler/scala/tools/nsc/package.scala')
-rw-r--r--src/compiler/scala/tools/nsc/package.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/package.scala b/src/compiler/scala/tools/nsc/package.scala
index 00a9f3b39c..5e8d4f7885 100644
--- a/src/compiler/scala/tools/nsc/package.scala
+++ b/src/compiler/scala/tools/nsc/package.scala
@@ -6,6 +6,15 @@
package scala.tools
package object nsc {
+ type Mode = scala.reflect.internal.Mode
+ val Mode = scala.reflect.internal.Mode
+
+ def EXPRmode = Mode.EXPRmode
+ def BYVALmode = Mode.BYVALmode
+ def POLYmode = Mode.POLYmode
+ def TAPPmode = Mode.TAPPmode
+ def FUNmode = Mode.FUNmode
+
type Phase = scala.reflect.internal.Phase
val NoPhase = scala.reflect.internal.NoPhase