diff options
author | Martin Odersky <odersky@gmail.com> | 2008-06-24 12:45:25 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-06-24 12:45:25 +0000 |
commit | b0c36c7a7c646caf95c7cda4a91681d243a0508d (patch) | |
tree | dc8d173de52c9c0f4bafd8db473b0e6431007f84 /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | |
parent | d8b12acb937667e1356af049c594302fa120f656 (diff) | |
download | scala-b0c36c7a7c646caf95c7cda4a91681d243a0508d.tar.gz scala-b0c36c7a7c646caf95c7cda4a91681d243a0508d.tar.bz2 scala-b0c36c7a7c646caf95c7cda4a91681d243a0508d.zip |
lazy vals cannot override strict vals and vice ...
lazy vals cannot override strict vals and vice versa; fixed
initialization bugs that caused scala and fsc to fail.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 0e2227e3ed..26e584e2e4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -186,9 +186,12 @@ abstract class RefChecks extends InfoTransform { overrideError("cannot override a mutable variable") } else if (other.isStable && !member.isStable) { // (1.4) overrideError("needs to be an immutable value") -// } else if (other.isStable && !other.isDeferred && other.owner.isTrait && (member hasFlag OVERRIDE)) { -// overrideError("cannot override a value or variable definition in a trait " + -// "\n (this is an implementation restriction)") + } else if (member.isValue && (member hasFlag LAZY) && + other.isValue && !other.isSourceMethod && !other.isDeferred && !(other hasFlag LAZY)) { + overrideError("cannot override a concrete non-lazy value") + } else if (other.isValue && (other hasFlag LAZY) && !other.isSourceMethod && !other.isDeferred && + member.isValue && !(member hasFlag LAZY)) { + overrideError("must be declared lazy to override a concrete lazy value") } else { if (other.isAliasType) { //if (!member.typeParams.isEmpty) // (1.5) @MAT |