Skip to content

NamedTuple.Names and NamedTuple.DropNames not working as expected #21194

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
kavedaa opened this issue Jul 14, 2024 · 3 comments
Closed

NamedTuple.Names and NamedTuple.DropNames not working as expected #21194

kavedaa opened this issue Jul 14, 2024 · 3 comments

Comments

@kavedaa
Copy link

kavedaa commented Jul 14, 2024

Compiler version

3.5.0-RC3

Minimized code

//> using scala 3.5.0-RC3, 3.nightly

import scala.language.experimental.namedTuples

object Test:

  val bar = (a = "hello", b = 1)

  summon[NamedTuple.Names[bar.type] <:< ("a", "b")]
    
  summon[NamedTuple.DropNames[bar.type] <:< (String, Int)]

Output

Compiling project (Scala 3.5.0-RC3, JVM (8))
[error] .\test.scala:9:52
[error] Cannot prove that NamedTupleDecomposition.Names[(Test.bar : (a : String, b : Int))] <:< (("a" : String), ("b" : String)).
[error]
[error] Note: a match type could not be fully reduced:
[error]
[error]   trying to reduce  NamedTupleDecomposition.Names[(Test.bar : (a : String, b : Int))]
[error]   failed since selector (Test.bar : (a : String, b : Int))
[error]   does not match  case NamedTuple.NamedTuple[n, _] => n
[error]   and cannot be shown to be disjoint from it either.
[error]   summon[NamedTuple.Names[bar.type] <:< ("a", "b")]
[error]                                                    ^
[error] .\test.scala:11:59
[error] Cannot prove that NamedTupleDecomposition.DropNames[(Test.bar : (a : String, b : Int))] <:< (String, Int).
[error]
[error] Note: a match type could not be fully reduced:
[error]
[error]   trying to reduce  NamedTupleDecomposition.DropNames[(Test.bar : (a : String, b : Int))]
[error]   failed since selector (Test.bar : (a : String, b : Int))
[error]   does not match  case NamedTuple.NamedTuple[_, x] => x
[error]   and cannot be shown to be disjoint from it either.
[error]   summon[NamedTuple.DropNames[bar.type] <:< (String, Int)]
[error]                                                           ^
Error compiling project (Scala 3.5.0-RC3, JVM (8))

Expectation

Successful compilation.

@kavedaa kavedaa added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 14, 2024
@WojciechMazur
Copy link
Contributor

WojciechMazur commented Jul 14, 2024

You're using the using directives incorrectly, it should be just

//> using scala 3.nightly

Seems like the directives parser in scala-cli is not warning about invalid values here. It's using the 1st valid value instead which in this case is 3.5.0-RC3
However, the rest of the issue remains valid as it fails to build with nightly

@bishabosha
Copy link
Member

this is a duplicate of #20453

@bishabosha bishabosha closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2024
@bishabosha bishabosha added stat:duplicate and removed itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 14, 2024
@kavedaa
Copy link
Author

kavedaa commented Nov 24, 2024

What does "not planned" mean here? I'm not able do draw any conclusions from the linked issue. Does it mean that this is not supposed to work?

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

No branches or pull requests

3 participants