summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-05-15 15:21:49 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-05-26 17:31:31 +0200
commit33446bd6f311a2bd5e565382836327fe5d337df7 (patch)
tree187d9cb6c72cf71598d4585c3fb38018bb38f966
parent748ab3044b681ee13d98dd48423d355d3f594b83 (diff)
downloadscala-33446bd6f311a2bd5e565382836327fe5d337df7.tar.gz
scala-33446bd6f311a2bd5e565382836327fe5d337df7.tar.bz2
scala-33446bd6f311a2bd5e565382836327fe5d337df7.zip
Optimize enforcement of dependent method type restrictions
- No need to check the result type, as dependent method types are now enabled unconditionally. - This also means we can only need to check methods with two or more parameter lists.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 205383d25a..099031d536 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1040,10 +1040,10 @@ trait Namers extends MethodSynthesis {
* so the resulting type is a valid external method type, it does not contain (references to) skolems.
*/
def thisMethodType(restpe: Type) = {
- val checkDependencies = new DependentTypeChecker(context)(this)
- checkDependencies check vparamSymss
- // DEPMETTODO: check not needed when they become on by default
- checkDependencies(restpe)
+ if (vparamSymss.lengthCompare(0) > 0) { // OPT fast path for methods of 0-1 parameter lists
+ val checkDependencies = new DependentTypeChecker(context)(this)
+ checkDependencies check vparamSymss
+ }
val makeMethodType = (vparams: List[Symbol], restpe: Type) => {
// TODODEPMET: check that we actually don't need to do anything here
@@ -1750,7 +1750,6 @@ trait Namers extends MethodSynthesis {
for (p <- vps)
this(p.info)
// can only refer to symbols in earlier parameter sections
- // (if the extension is enabled)
okParams ++= vps
}
}