summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2009-06-15 15:03:20 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2009-06-15 15:03:20 +0000
commit7337db9c59daeac26e81e22cfea4f7d8b43a0747 (patch)
treefdf3fa7868907040432296e889f8030010c7b3e6 /src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
parenta907772ff59f7150637494f46b60665ca6e21163 (diff)
downloadscala-7337db9c59daeac26e81e22cfea4f7d8b43a0747.tar.gz
scala-7337db9c59daeac26e81e22cfea4f7d8b43a0747.tar.bz2
scala-7337db9c59daeac26e81e22cfea4f7d8b43a0747.zip
allow using named / default arguments in self- ...
allow using named / default arguments in self- and super constructor calls. fixes #2050 and #2052.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
index b104bed2c7..0ede740b00 100644
--- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
@@ -179,13 +179,23 @@ trait NamesDefaults { self: Analyzer =>
assert(treeInfo.isPureExpr(qual), qual)
blockWithoutQualifier(baseFun1, defaultQual)
+ // super constructor calls
+
+ case Select(Super(_, _), _) if isConstr =>
+ blockWithoutQualifier(baseFun1, None)
+
+ // self constructor calls (in secondary constructors)
+
+ case Select(qual, name) if isConstr =>
+ assert(treeInfo.isPureExpr(qual), qual)
+ blockWithoutQualifier(baseFun1, None)
+
// other method calls
case Ident(_) =>
blockWithoutQualifier(baseFun1, None)
case Select(qual, name) =>
- assert(!isConstr, baseFun1)
if (treeInfo.isPureExpr(qual))
blockWithoutQualifier(baseFun1, Some(qual.duplicate))
else
@@ -224,11 +234,7 @@ trait NamesDefaults { self: Analyzer =>
}
// begin transform
- if (treeInfo.isSelfConstrCall(tree)) {
- errorTree(tree, "using named or default arguments in a self constructor call is not allowed")
- } else if (treeInfo.isSuperConstrCall(tree)) {
- errorTree(tree, "using named or default arguments in a super constructor call is not allowed")
- } else if (isNamedApplyBlock(tree)) {
+ if (isNamedApplyBlock(tree)) {
context.namedApplyBlockInfo.get._1
} else tree match {
// we know that Apply(Apply(...)) can only be an application of a curried method;