File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,8 @@ class Namer { typer: Typer =>
389389 val name = checkNoConflict(tree.name, flags.is(Private ), tree.span)
390390 tree match
391391 case tree : ValOrDefDef =>
392+ if tree.isInstanceOf [ValDef ] && ! flags.is(Param ) && name.endsWith(" _=" ) then
393+ ctx.error(" Names of vals or vars may not end in `_=`" , tree.namePos)
392394 if tree.unforcedRhs == EmptyTree
393395 && ! flags.isOneOf(TermParamOrAccessor )
394396 && ! tree.name.isConstructorName
Original file line number Diff line number Diff line change 1+ class C {
2+ var __= : Int = 42 // error
3+ var x_= : Int = 42 // error
4+ }
5+
6+ class D {
7+ val __= : Int = 42 // error
8+ val x_= : Int = 42 // error
9+ }
10+
11+ class E {
12+ lazy val __= : Int = 42 // error
13+ lazy val x_= : Int = 42 // error
14+ }
15+
16+ class F {
17+ def __= : Int = 42
18+ def x_= : Int = 42
19+ }
You can’t perform that action at this time.
0 commit comments