-
Couldn't load subscription status.
- Fork 1.1k
Closed as not planned
Labels
area:experimental:modularityIssues related to the modularity extension.Issues related to the modularity extension.area:inferarea:inlineitype:enhancementitype:question
Description
Compiler version
3.7.2
Minimized code
https://scastie.scala-lang.org/hSVqiYRGQEOtddYD6PAYzQ
//> using scala 3.7.2
//> using options -Wall -Werror
//def singleton[T <: Singleton](v: T): T = v
// transparent does not help either
inline def singleton[T <: Singleton](inline v: T): T = v
enum Foo:
case A
case B
val e = singleton(Foo.A)
val e1: Foo.A.type = e // fail
// does not work for literal types
val s = singleton("a")
val s1: "a" = s // failOutput
Found: (Playground.e : Playground.Foo)
Required: (Playground.Foo.A : Playground.Foo)
Found: (Playground.s : String)
Required: ("a" : String)Expectation
- transparent inline should preserve singleton type, especially with
Singletoncontraint - it would be useful if this worked even without inline, i.e. in presence of
Singletonshould infer actual singleton type
Metadata
Metadata
Assignees
Labels
area:experimental:modularityIssues related to the modularity extension.Issues related to the modularity extension.area:inferarea:inlineitype:enhancementitype:question