-
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.
Make right assoc ext method fwd refs error (#21641)
Fixes #16815
- Loading branch information
Showing
3 changed files
with
64 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- Error: tests/neg/i16815.scala:3:37 ---------------------------------------------------------------------------------- | ||
3 |extension [C1 >: Chain <: Chain](c2: c1.Tail) // error | ||
| ^^ | ||
| right-associative extension method cannot have a forward reference to c1 | ||
-- Error: tests/neg/i16815.scala:6:24 ---------------------------------------------------------------------------------- | ||
6 |extension [C1](c2: (C1, C2)) // error | ||
| ^^ | ||
| right-associative extension method cannot have a forward reference to C2 | ||
-- Error: tests/neg/i16815.scala:9:19 ---------------------------------------------------------------------------------- | ||
9 |extension [C1](c2: C2) // error | ||
| ^^ | ||
| right-associative extension method cannot have a forward reference to C2 | ||
-- Error: tests/neg/i16815.scala:12:24 --------------------------------------------------------------------------------- | ||
12 |extension [C1](c2: (C1, C2, C3)) // error // error | ||
| ^^ | ||
| right-associative extension method cannot have a forward reference to C2 | ||
-- Error: tests/neg/i16815.scala:12:28 --------------------------------------------------------------------------------- | ||
12 |extension [C1](c2: (C1, C2, C3)) // error // error | ||
| ^^ | ||
| right-associative extension method cannot have a forward reference to C3 | ||
-- Error: tests/neg/i16815.scala:15:48 --------------------------------------------------------------------------------- | ||
15 |extension [C1](str: String)(using z: (str.type, C2)) // error | ||
| ^^ | ||
| right-associative extension method cannot have a forward reference to C2 | ||
-- Error: tests/neg/i16815.scala:19:31 --------------------------------------------------------------------------------- | ||
19 |extension [D1 <: Int](D2: (D1, D2)) // error | ||
| ^^ | ||
| right-associative extension method cannot have a forward reference to D2 |
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 @@ | ||
trait Chain { type Tail <: Chain } | ||
|
||
extension [C1 >: Chain <: Chain](c2: c1.Tail) // error | ||
def ra1_:[C2 <: C1](c1: C1): C2 = ??? | ||
|
||
extension [C1](c2: (C1, C2)) // error | ||
def ra2_:[C2 <: C1](c1: (C1, C2)): C2 = ??? | ||
|
||
extension [C1](c2: C2) // error | ||
def ra3_:[C2 <: C1](c1: C1): C2 = ??? | ||
|
||
extension [C1](c2: (C1, C2, C3)) // error // error | ||
def ra4_:[C2 <: C1, C3 <: C1](c1: (C1, C2)): C2 = ??? | ||
|
||
extension [C1](str: String)(using z: (str.type, C2)) // error | ||
def ra5_:[C2 <: Int](c1: C1): C2 = ??? | ||
|
||
type D2 = String | ||
extension [D1 <: Int](D2: (D1, D2)) // error | ||
def sa2_:[D2 <: D1](D1: (D1, D2)): D2 = ??? |