-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an error message for local final defs
Co-Authored-By: Eugene Flesselle <[email protected]> Co-Authored-By: anna herlihy <[email protected]> Co-Authored-By: Oliver Bračevac <[email protected]>
- Loading branch information
1 parent
af6beec
commit 3b2f444
Showing
5 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- [E199] Syntax Error: tests/neg/17579.scala:4:10 --------------------------------------------------------------------- | ||
4 | final val v1 = 42 // error | ||
| ^^^ | ||
| The final modifier is not allowed on local definitions | ||
-- [E199] Syntax Error: tests/neg/17579.scala:5:15 --------------------------------------------------------------------- | ||
5 | final lazy val v2 = 42 // error | ||
| ^^^ | ||
| The final modifier is not allowed on local definitions | ||
-- [E088] Syntax Error: tests/neg/17579.scala:6:10 --------------------------------------------------------------------- | ||
6 | final private val v3 = 42 // error | ||
| ^^^^^^^ | ||
| Expected start of definition | ||
| | ||
| longer explanation available when compiling with `-explain` | ||
-- [E199] Syntax Error: tests/neg/17579.scala:7:10 --------------------------------------------------------------------- | ||
7 | final def v4 = 42 // error | ||
| ^^^ | ||
| The final modifier is not allowed on local definitions | ||
-- [E199] Syntax Error: tests/neg/17579.scala:8:10 --------------------------------------------------------------------- | ||
8 | final var v5 = 42 // error | ||
| ^^^ | ||
| The final modifier is not allowed on local definitions | ||
-- [E199] Syntax Error: tests/neg/17579.scala:9:10 --------------------------------------------------------------------- | ||
9 | final type Foo = String // error | ||
| ^^^^ | ||
| The final modifier is not allowed on local definitions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class C: | ||
final var v = 42 // ok | ||
def f = | ||
final val v1 = 42 // error | ||
final lazy val v2 = 42 // error | ||
final private val v3 = 42 // error | ||
final def v4 = 42 // error | ||
final var v5 = 42 // error | ||
final type Foo = String // error | ||
final given String = ??? |