Skip to content

scala.compiletime.ops.any.== has overly restrictive type bounds #8721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
noelwelsh opened this issue Apr 14, 2020 · 2 comments
Closed

scala.compiletime.ops.any.== has overly restrictive type bounds #8721

noelwelsh opened this issue Apr 14, 2020 · 2 comments
Labels

Comments

@noelwelsh
Copy link

Minimized code

Using an example from the documentation of any.==

import scala.compiletime.ops.any._
val eq3: "1" == "1" = true

Output

1 |val eq3: "1" == "1" = true
  |         ^
  |       Type argument ("1" : String) does not conform to upper bound AnyVal
1 |val eq3: "1" == "1" = true
  |                ^
  |       Type argument ("1" : String) does not conform to upper bound AnyVal

Expectation

This code should compile to the value true. The overly restrictive type bound on any.== prevents string type literals being used with any.==.

@liufengyun
Copy link
Contributor

This is due to the restriction that X <: AnyVal, while String is not a value type.

    @infix type ==[X <: AnyVal, Y <: AnyVal] <: Boolean

/cc: @MaximeKjaer @OlivierBlanvillain

@bishabosha
Copy link
Member

this is a duplicate of #8392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants