summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-21 00:26:39 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-21 00:26:39 -0700
commit320a32b0b5902781b9fb13ad83083574a36f3e46 (patch)
tree3155d95602e4d4012f3aaab3abd931bb68b293f0 /src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
parent6aea0ae85f72594798ec6c96e30cc1aef48c3a99 (diff)
parent6aa5762fa0333625ec93378e2147649a8bafde34 (diff)
downloadscala-320a32b0b5902781b9fb13ad83083574a36f3e46.tar.gz
scala-320a32b0b5902781b9fb13ad83083574a36f3e46.tar.bz2
scala-320a32b0b5902781b9fb13ad83083574a36f3e46.zip
Merge pull request #735 from retronym/ticket/4842-2
SI-4842 Forbid access to in-construction this in self-constructor args
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index e5e8acc185..60cc9e5fb8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -222,7 +222,13 @@ trait ContextErrors {
NormalTypeError(tree, "super constructor cannot be passed a self reference unless parameter is declared by-name")
def SuperConstrArgsThisReferenceError(tree: Tree) =
- NormalTypeError(tree, "super constructor arguments cannot reference unconstructed `this`")
+ ConstrArgsThisReferenceError("super", tree)
+
+ def SelfConstrArgsThisReferenceError(tree: Tree) =
+ ConstrArgsThisReferenceError("self", tree)
+
+ private def ConstrArgsThisReferenceError(prefix: String, tree: Tree) =
+ NormalTypeError(tree, s"$prefix constructor arguments cannot reference unconstructed `this`")
def TooManyArgumentListsForConstructor(tree: Tree) = {
issueNormalTypeError(tree, "too many argument lists for constructor invocation")