-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Version
RC-1.0
Scala Version
3.7..2
Expected Behavior
I would expect the compiler to succeed even when the -Wsafe-init flat is enabled.
It's not clear to me if this is a problem triggered by Kyo's own macro code, or is it a compiler error in the code path handling the -Wsafe-init option, for a condition triggered by Kyo's code and not correctly handled.
Actual Behavior
When compiling the following code with the -Wsafe-init compiler option, the compiler fails with a macro expansion error.
ThisBuild / scalacOptions ++= Seq("-Wsafe-init")import java.security.MessageDigest
import kyo.Sink
val sha256: Sink[Byte, Array[Byte], Any] = {
val digest = MessageDigest.getInstance("SHA-256")
Sink.foreach((b: Byte) => digest.update(b)).map(_ => digest.digest())
}[error] 6 | Sink.foreach((b: Byte) => digest.update(b)).map(_ => digest.digest())
[error] | ^
[error] |Exception occurred while executing macro expansion.
[error] |scala.MatchError: HKTypeLambda(List(A), List(TypeBounds(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),Nothing),TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),Any))), OrType(TypeRef(ThisType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object kyo),module class Maybe$package$)),type Absent),AppliedType(TypeRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object kyo),object Maybe$package),object Maybe),type Present),List(TypeParamRef(A))))) (of class dotty.tools.dotc.core.Types$HKTypeLambda)
Steps to Reproduce
Setting the -Wsafe-init option for the compiler will result in the above error.
Removing the -Wsafe-init option the compilation completes successfully.
Current Workaround
Remove the -Wsafe-init compiler option.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working