question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use-site `nonsensical` error with "sequence match" variadic extractor

See original GitHub issue

Compiler 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:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Sporarumcommented, Oct 3, 2022

It appears this bug was already posted as an issue on Scastie … by me … https://github.com/scalacenter/scastie/issues/635

0reactions
Sporarumcommented, Oct 3, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found