diff options
author | Paul Phillips <paulp@improving.org> | 2013-05-11 13:02:54 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-11 13:02:54 -0700 |
commit | 1c1d45d08f5d303d00e97383722b10f9c9395f4e (patch) | |
tree | 27b4b56a1650c1a23d0a631ca9b33014293bf10c /src/compiler/scala/tools/nsc/typechecker/Contexts.scala | |
parent | 751daa9b3825543bd04eaa4eab6438f8410f6040 (diff) | |
download | scala-1c1d45d08f5d303d00e97383722b10f9c9395f4e.tar.gz scala-1c1d45d08f5d303d00e97383722b10f9c9395f4e.tar.bz2 scala-1c1d45d08f5d303d00e97383722b10f9c9395f4e.zip |
Eliminated SNDTRYmode.
It becomes context mode "SecondTry".
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 0633c1485f..dc75fa3746 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -241,6 +241,8 @@ trait Contexts { self: Analyzer => def checking = this(Checking) def retyping_=(value: Boolean) = this(ReTyping) = value def retyping = this(ReTyping) + def inSecondTry = this(SecondTry) + def inSecondTry_=(value: Boolean) = this(SecondTry) = value /** These messages are printed when issuing an error */ var diagnostic: List[String] = Nil @@ -357,6 +359,7 @@ trait Contexts { self: Analyzer => def withMacrosDisabled[T](op: => T): T = withMode(disabled = MacrosEnabled)(op) def withStarPatterns[T](op: => T): T = withMode(enabled = StarPatterns)(op) def withSuperInit[T](op: => T): T = withMode(enabled = SuperInit)(op) + def withSecondTry[T](op: => T): T = withMode(enabled = SecondTry)(op) /** @return true if the `expr` evaluates to true within a silent Context that incurs no errors */ @inline final def inSilentMode(expr: => Boolean): Boolean = { @@ -1333,8 +1336,9 @@ object ContextMode { /** Are we in a run of [[scala.tools.nsc.typechecker.TreeCheckers]]? */ final val Checking: ContextMode = 1 << 9 - /** Are we retypechecking arguments independently from the function applied to them? See `Typer.tryTypedApply` */ - // TODO This seems to directly overlap with Mode.SNDTRYmode + /** Are we retypechecking arguments independently from the function applied to them? See `Typer.tryTypedApply` + * TODO - iron out distinction/overlap with SecondTry. + */ final val ReTyping: ContextMode = 1 << 10 /** Are we typechecking pattern alternatives. Formerly ALTmode. */ @@ -1346,6 +1350,11 @@ object ContextMode { /** Are we typing the "super" in a superclass constructor call super.<init>. Formerly SUPERCONSTRmode. */ final val SuperInit: ContextMode = 1 << 13 + /* Is this the second attempt to type this tree? In that case functions + * may no longer be coerced with implicit views. Formerly SNDTRYmode. + */ + final val SecondTry: ContextMode = 1 << 14 + final val DefaultMode: ContextMode = MacrosEnabled private val contextModeNameMap = Map( @@ -1359,7 +1368,9 @@ object ContextMode { Checking -> "Checking", ReTyping -> "ReTyping", PatternAlternative -> "PatternAlternative", - StarPatterns -> "StarPatterns" + StarPatterns -> "StarPatterns", + SuperInit -> "SuperInit", + SecondTry -> "SecondTry" ) } |