Looks like a regression to me, I’ve created an issue to track progress and discussions on this issue. As a temporal workaround you can use Scala 3.3.0 (does not have this regression) instead of 3.3.1. The earliest the fix can be applied is 3.3.3 which is ~6 weeks from now.
opened 09:50PM - 16 Feb 24 UTC
itype:bug
area:typer
regression
Based on forum post: https://users.scala-lang.org/t/scala-3-how-do-we-make-a-lam… bda-type-conform-to-a-subtype/9805
## Compiler version
3.3.1
Last good release: 3.3.1-RC1-bin-20230514-b0ccf40-NIGHTLY
First bad release: 3.3.1-RC1-bin-20230515-22b2259-NIGHTLY
Bisect points to d1d6c2e9536ce331316f741b9c1c4c0520cef787
## Minimized code
```Scala
import scala.util.NotGiven
type HasName1 = [n] =>> [x] =>> x match {
case n => true
case _ => false
}
@main def Test = {
summon[HasName1["foo"]["foo"] =:= true]
summon[NotGiven[HasName1["foo"]["bar"] =:= true]]
summon[Tuple.Filter[(1, "foo", 2, "bar"), HasName1["foo"]] =:= Tuple1["foo"]] // error
}
```
## Output
```scala
-- [E057] Type Mismatch Error: /Users/wmazur/projects/dotty/bisect/main.scala:10:44
10 | summon[Tuple.Filter[(1, "foo", 2, "bar"), HasName1["foo"]] =:= Tuple1["foo"]]
| ^
|Type argument HasName1[("foo" : String)] does not conform to upper bound [_] =>> Boolean
|
|Note: a match type could not be fully reduced:
|
| trying to reduce HasName1[("foo" : String)]
|
| longer explanation available when compiling with `-explain`
1 error found
```
## Expectation
Should comile (probably)
2 Likes