Use-site `nonsensical` error with "sequence match" variadic extractor
See original GitHub issueCompiler version
3.2.1-RC2 / 3.2.0
Minimized code & Output
class Foo
type T1
type T2 <: T1
type T3 <: T1
object Foo1:
def unapplySeq(f: Foo) = Foo2
object Foo2:
def lengthCompare(len: Int): Int = ???
def apply(i: Int): T1 = ???
def drop(n: Int): scala.Seq[T2] = ???
def toSeq: scala.Seq[T3] = ???
new Foo match
case Foo1(x1,x2,x3) => println(s"$x1,$x2,$x3") // error:
// Recursive <nonsensical>value $t</nonsensical> needs type
https://scastie.scala-lang.org/fwuFJYs1RZOjgCK6Y3xzqA
Without the match
no error is thrown
Expectation
This looks like it should be a valid instance of a “sequence match” (as seen here), so it should not throw any errors
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How To Use Variadic Functions in Go
A variadic function is a function that accepts zero, one, or more values as a single argument. While variadic functions are not the...
Read more >How to extract a selected set of arguments of a variadic ...
You can create a helper to extract the nth_arg like this: template <int I> struct ignore { template <typename T> ignore(T&&) // This...
Read more >C++20 idioms for parameter packs
Overview of variadic templates. A variadic template is a template whose definition captures a parameter pack in its template arguments or function arguments....
Read more >C++ Compiler error when you mix variadic templates and ...
Cause. The cause is that the C++ compiler can't match the declaration of the friend function to an existing declaration. Resolution.
Read more >Unpacking Tuples in C++14 - Andreas Herrmann
We construct a parameter pack of integers and use a helper function to extract all the tuple elements. template <class Tuple, class F,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It appears this bug was already posted as an issue on Scastie … by me … https://github.com/scalacenter/scastie/issues/635
It appears to be a wrapping bug, as even in Scastie, putting the expression in a
def
solves the issue: https://scastie.scala-lang.org/7KGmjykfQXOwVcj1X5GQqw