summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-04-16 22:42:07 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-04-21 13:05:28 +0200
commite112db6fc4afe0a7721ec87423eacd405fa6c89b (patch)
treebb3035d69000a424431ee491bfa17ed749f08990 /src/compiler/scala/tools/nsc/typechecker/Contexts.scala
parent0ce81c855fc8c12623ae49f1cfa6e1fb255c872a (diff)
downloadscala-e112db6fc4afe0a7721ec87423eacd405fa6c89b.tar.gz
scala-e112db6fc4afe0a7721ec87423eacd405fa6c89b.tar.bz2
scala-e112db6fc4afe0a7721ec87423eacd405fa6c89b.zip
SI-7345 Factor out method to clear and restore undetparams.
Also refactored `handleOverloaded` to avoid use of a mutable Buffer
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index dd43e22159..ae1ff24e76 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -262,6 +262,20 @@ trait Contexts { self: Analyzer =>
tparams
}
+ /** Run `body` with this context with no undetermined type parameters, restore the original
+ * the original list afterwards.
+ * @param reportAmbiguous Should ambiguous errors be reported during evaluation of `body`?
+ */
+ def savingUndeterminedTypeParams[A](reportAmbiguous: Boolean = ambiguousErrors)(body: => A): A = {
+ withMode() {
+ this(AmbiguousErrors) = reportAmbiguous
+ val savedParams = extractUndetparams()
+ try body
+ finally {
+ undetparams = savedParams
+ }
+ }
+ }
//
// Error reporting policies and buffer.
//