diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-06-21 00:26:39 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-06-21 00:26:39 -0700 |
commit | 320a32b0b5902781b9fb13ad83083574a36f3e46 (patch) | |
tree | 3155d95602e4d4012f3aaab3abd931bb68b293f0 /src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | |
parent | 6aea0ae85f72594798ec6c96e30cc1aef48c3a99 (diff) | |
parent | 6aa5762fa0333625ec93378e2147649a8bafde34 (diff) | |
download | scala-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.scala | 8 |
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") |