forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disallow toplevel infix definitions for vals, vars, givens, meth…
…ods and implicits Part of scala#17738
- Loading branch information
Showing
5 changed files
with
46 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,20 @@ | ||
-- [E183] Syntax Error: tests/neg/i17738-toplevel-infix.scala:10:10 ---------------------------------------------------- | ||
10 |infix val toplevelVal = ??? // error | ||
| ^ | ||
| a toplevel val cannot be infix | ||
-- [E183] Syntax Error: tests/neg/i17738-toplevel-infix.scala:11:10 ---------------------------------------------------- | ||
11 |infix var toplevelVar = ??? // error | ||
| ^ | ||
| a toplevel var cannot be infix | ||
-- [E183] Syntax Error: tests/neg/i17738-toplevel-infix.scala:12:10 ---------------------------------------------------- | ||
12 |infix def toplevelDef = ??? // error | ||
| ^ | ||
| a toplevel def cannot be infix | ||
-- [E183] Syntax Error: tests/neg/i17738-toplevel-infix.scala:13:12 ---------------------------------------------------- | ||
13 |infix given toplevelGiven: Int = ??? // error | ||
| ^ | ||
| a toplevel given cannot be infix | ||
-- [E183] Syntax Error: tests/neg/i17738-toplevel-infix.scala:14:19 ---------------------------------------------------- | ||
14 |infix implicit val topevelImplicit: Int = ??? // error | ||
| ^ | ||
| a toplevel val cannot be infix |
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,14 @@ | ||
infix type A[b, a] = Nothing | ||
|
||
infix type B[b, a] = b match { | ||
case Int => a | ||
} | ||
|
||
infix class C[A, B] | ||
infix trait D[A, B] | ||
|
||
infix val toplevelVal = ??? // error | ||
infix var toplevelVar = ??? // error | ||
infix def toplevelDef = ??? // error | ||
infix given toplevelGiven: Int = ??? // error | ||
infix implicit val topevelImplicit: Int = ??? // error |