Skip to content

Option.apply type inference #24571

@xuwei-k

Description

@xuwei-k

Compiler version

3.8.0-RC2

Minimized code

//> using scala 3.8.0-RC2

val x: Option[Byte] = Option(2)

Output

Compiling project (Scala 3.8.0-RC2, JVM (21))
[error] ./A.scala:3:30
[error] Found:    (2 : Int)
[error] Required: Byte | Null
[error] val x: Option[Byte] = Option(2)
[error]                              ^
Error compiling project (Scala 3.8.0-RC2, JVM (21))

Expectation

Scala 3.7

Welcome to Scala 3.7.4 (21.0.9, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                                          
scala> val x: Option[Byte] = Option(2)
val x: Option[Byte] = Some(2)

Metadata

Metadata

Assignees

Labels

itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions