-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)patmat
Milestone
Description
The following code
import zio.prelude.Subtype
object PreludeForComprehensionIssue extends App {
object ArbitrarySubType extends Subtype[String]
type ArbitrarySubType = ArbitrarySubType.Type
val subTypeInstance: ArbitrarySubType = ArbitrarySubType("I am the sub type instance")
val result = for {
_ <- Some("A")
b: ArbitrarySubType <- Some(subTypeInstance)
} yield b
println(result)
}produces the error
scrutinee is incompatible with pattern type;
found : PreludeForComprehensionIssue.ArbitrarySubType
(which expands to) PreludeForComprehensionIssue.ArbitrarySubType.Type
required: Stringin Scala 2.13.9. It compiles without issues in Scala 3.2.0.
It can also be compiled without issues by adding better-monadic-for https://github.com/oleg-py/better-monadic-for
It can be tried via https://scastie.scala-lang.org/nYj3MNfXQFGE62TaQK7G5A
The only required dependency is "dev.zio" %% "zio-prelude" % "1.0.0-RC16",
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)patmat