- Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:desugarDesugaring happens after parsing but before typing, see desugar.scalaDesugaring happens after parsing but before typing, see desugar.scalaarea:experimental.betterForsIssues related to the betterFors language extensionIssues related to the betterFors language extensionitype:bugstat:sip-in-progress
Milestone
Description
Compiler version
3.6.1-RC1-bin-20241017-59b67fc-NIGHTLY
Minimized code
//> using scala 3.nightly import scala.language.experimental.betterFors case class Container[A](val value: A) { def map[B](f: A => B): Container[B] = Container(f(value)) } sealed trait Animal case class Dog() extends Animal def opOnDog(dog: Container[Dog]): Container[Animal] = for v <- dog yield vOutput
-- [E007] Type Mismatch Error: /home/kpi/bugs/better-fors-bug.scala:13:2 ------- 13 | for | ^ | Found: (dog : Container[Dog]) | Required: Container[Animal] 14 | v <- dog 15 | yield v | | longer explanation available when compiling with `-explain`without betterFors enabled, this code compiles successfully.
Expectation
The type of the for-comprehension should not be changed after enabling the betterFors language extension.
jivanic-demystdata
Metadata
Metadata
Assignees
Labels
area:desugarDesugaring happens after parsing but before typing, see desugar.scalaDesugaring happens after parsing but before typing, see desugar.scalaarea:experimental.betterForsIssues related to the betterFors language extensionIssues related to the betterFors language extensionitype:bugstat:sip-in-progress