Skip to content

Commit 624cc47

Browse files
authored
Merge pull request #8723 from MaximeKjaer/fix-singleton-ops-8392
Fix #8392: Remove parameter type bounds from scala.compiletime.ops.any types
2 parents c054c62 + c4f9e60 commit 624cc47

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

library/src/scala/compiletime/ops/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package object ops {
1111
* val eq3: "1" == "1" = true
1212
* ```
1313
*/
14-
@infix type ==[X <: AnyVal, Y <: AnyVal] <: Boolean
14+
@infix type ==[X, Y] <: Boolean
1515

1616
/** Inequality comparison of two singleton types.
1717
* ```scala
@@ -20,7 +20,7 @@ package object ops {
2020
* val eq3: "1" != "1" = false
2121
* ```
2222
*/
23-
@infix type !=[X <: AnyVal, Y <: AnyVal] <: Boolean
23+
@infix type !=[X, Y] <: Boolean
2424
}
2525

2626
object string {

tests/neg/singleton-ops-any.check

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- [E007] Type Mismatch Error: tests/neg/singleton-ops-any.scala:6:23 --------------------------------------------------
2+
6 | val t34: 10 == "5" = true // error
3+
| ^^^^
4+
| Found: (true : Boolean)
5+
| Required: (false : Boolean)
6+
-- [E007] Type Mismatch Error: tests/neg/singleton-ops-any.scala:7:22 --------------------------------------------------
7+
7 | val t35: 10 == 10 = false // error
8+
| ^^^^^
9+
| Found: (false : Boolean)
10+
| Required: (true : Boolean)
11+
-- [E007] Type Mismatch Error: tests/neg/singleton-ops-any.scala:12:24 -------------------------------------------------
12+
12 | val t38: false != 5 = false // error
13+
| ^^^^^
14+
| Found: (false : Boolean)
15+
| Required: (true : Boolean)
16+
-- [E007] Type Mismatch Error: tests/neg/singleton-ops-any.scala:13:22 -------------------------------------------------
17+
13 | val t39: 10 != 10 = true // error
18+
| ^^^^
19+
| Found: (true : Boolean)
20+
| Required: (false : Boolean)

tests/neg/singleton-ops-any.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ object Test {
55
val t33: 0 == false = false
66
val t34: 10 == "5" = true // error
77
val t35: 10 == 10 = false // error
8+
val t35string: "10" == "10" = true
89

910
val t36: 1 != 1 = false
1011
val t37: 0 != 1 = true

0 commit comments

Comments
 (0)