-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:flexible-typesIssues tied to FlexibleTypeIssues tied to FlexibleTypearea:implicitsrelated to implicitsrelated to implicitsarea:nullabilityarea:private optionsIssues tied to -Y private/internal compiler settings.Issues tied to -Y private/internal compiler settings.itype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore
Description
Based on OpenCB failure in broij/zarrow - build logs
The compilation succeeds if both compilation units use -Yexplicit-nulls
or if both do not use it. In case of mixed mode it fails to build
Compiler version
Last good release: 3.8.0-RC1-bin-20250821-0a7f843-NIGHTLY
First bad release: 3.8.0-RC1-bin-20250822-658c8bd-NIGHTLY
Minimized code
Requires separate compilation units
// 1_defs.scala
object ZIO:
def attempt[A](code: => A): ZIO[Any, Throwable, A] = ???
trait ZIO[-R, +E, +A]:
final def flatten[R1 <: R, E1 >: E, B](using A IsSubtypeOfOutput ZIO[R1, E1, B]): ZIO[R1, E1, B] = ???
infix sealed abstract class IsSubtypeOfOutput[-A, +B]
object IsSubtypeOfOutput:
given [A, B](using A <:< B): IsSubtypeOfOutput[A, B] = ???
// 2_usage.scala
//> using options -Yexplicit-nulls
opaque type ZArrow[-I, -R, +E, +O] = I => ZIO[R, E, O]
object ZArrow:
def fromZIOAttempt[I, R, E, O](f: I => ZIO[R, E, O]): ZArrow[I, R, Throwable | E, O] =
(in: I) => ZIO.attempt(f(in)).flatten
Output
-- [E172] Type Error: /Users/wmazur/projects/scala/community-build3/test2.test.scala:7:41 ---------------------------------------------------------------------------------------------------
7 | (in: I) => ZIO.attempt(f(in)).flatten
| ^
| No given instance of type ((ZIO[R, E, O])? IsSubtypeOfOutput (ZIO[(R1)?, ((Throwable)?)?, (B)?])?)? was found for parameter x$1 of method flatten in trait ZIO.
| I found:
|
| IsSubtypeOfOutput.given_IsSubtypeOfOutput_A_B[(ZIO[R, E, O])?, (((ZIO[R, E, O])?)?)?](<:<.refl[((ZIO[R, E, O])?)?])
|
| But given instance given_IsSubtypeOfOutput_A_B in object IsSubtypeOfOutput does not match type ((ZIO[R, E, O])? IsSubtypeOfOutput (ZIO[(R1)?, ((Throwable)?)?, (B)?])?)?
|
| where: B is a type variable with constraint <: O
| R1 is a type variable with constraint >: R and <: (Any)?
| .
1 error found
Expectation
Metadata
Metadata
Assignees
Labels
area:flexible-typesIssues tied to FlexibleTypeIssues tied to FlexibleTypearea:implicitsrelated to implicitsrelated to implicitsarea:nullabilityarea:private optionsIssues tied to -Y private/internal compiler settings.Issues tied to -Y private/internal compiler settings.itype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymore