diff options
Diffstat (limited to 'test/files/neg/lazyvals.scala')
-rw-r--r-- | test/files/neg/lazyvals.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/neg/lazyvals.scala b/test/files/neg/lazyvals.scala new file mode 100644 index 0000000000..8514d42c13 --- /dev/null +++ b/test/files/neg/lazyvals.scala @@ -0,0 +1,26 @@ + +/** Test which should fail compilation */ +class Lazy { + + // no abstract lazy values + lazy val t: Int + + // no lazy var + lazy var p: Int = 100 + + // no lazy defs + lazy def q: Double = 0.0 + + def foo { + lazy val t; + () + } + + // no trait/class/object can be lazy + lazy trait T {} + lazy class C {} + lazy object O {} + + // no lazy modifiers in class parameters + class A(lazy val obj: Object) {} +} |