File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1839,7 +1839,16 @@ object Parsers {
1839
1839
val start = in.offset
1840
1840
var mods = annotsAsMods()
1841
1841
if (owner.isTypeName) {
1842
- mods = modifiers(start = mods) | ParamAccessor
1842
+ mods = modifiers(start = mods)
1843
+ if (mods.is(Lazy ))
1844
+ syntaxError(" `lazy' modifier not allowed here. Use call-by-name parameters instead" )
1845
+ mods =
1846
+ if (mods.is(Sealed )) {
1847
+ syntaxError(" `sealed' modifier can be used only for classes" )
1848
+ mods // Adding ParamAccessor would crash
1849
+ } else {
1850
+ mods | ParamAccessor
1851
+ }
1843
1852
mods =
1844
1853
atPos(start, in.offset) {
1845
1854
if (in.token == VAL ) {
Original file line number Diff line number Diff line change
1
+ class A (sealed val a : Int ) // error
2
+ class B (lazy val a : Int ) // error
3
+ class C (abstract val a : Int ) // error
You can’t perform that action at this time.
0 commit comments