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.

Tuples created through *: do not have a Mirror.Of[T]

See original GitHub issue

Compiler version

3.1.1-RC1 3.1.0

Minimized code

summon[Mirror.Of[Int *: String *: Boolean *: EmptyTuple]]

Output

no implicit argument of type deriving.Mirror.Of[Int *: String *: Boolean *: EmptyTuple] was found for parameter x of method summon in object Predef

Expectation

Output should be the same as:

summon[Mirror.Of[(Int, String, Boolean)]]

since

summon[(Int, String, Boolean) =:= (Int *: String *: Boolean *: EmptyTuple)]

The cause seems related to the fact that *: is an abstract class and those are excluded from being generic products. Relevant links: https://github.com/lampepfl/dotty/blob/7a473349b3fb64e7c6c9dfcfb02758f4a2e3756c/library/src/scala/Tuple.scala#L318

https://github.com/lampepfl/dotty/blob/7a473349b3fb64e7c6c9dfcfb02758f4a2e3756c/compiler/src/dotty/tools/dotc/typer/Synthesizer.scala#L233

https://github.com/lampepfl/dotty/blob/master/compiler/src/dotty/tools/dotc/transform/SymUtils.scala#L77-L88

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
nicolasstuckicommented, Apr 19, 2022

There was no real reason why we did not make EmptyTuple a case object. Maybe we followed the design of the *:.

The *: cannot be a case class because it is not a real runtime class. The TupleN classes from Scala 2 are used and a new TupleXXL for larger cases (above 22).

I’m trying to make EmptyTuple a case object in #14972 to see if we can.

1reaction
armanbilgecommented, Apr 16, 2022

Not sure if it deserves its own issue, but seems that EmptyTuple itself doesn’t have a Mirror.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lecture 8 — Tuples, Modules, Images - Computer Science
A tuple is simply a container like a list. The main distinctions are: It uses parantheses instead of square brackets; More importantly, its...
Read more >
Python Tuples and Tuple Methods - Medium
Tuples are an ordered sequences of items, just like lists. The main difference between tuples and lists is that tuples cannot be changed...
Read more >
Recursively mirroring a nested tuple in Python - Stack Overflow
One solution I can think of is recursively building each piece in the final reversed result, and then using itertools to join them...
Read more >
Python - Tuples - Tutorialspoint
A tuple is a collection of objects which ordered and immutable. Tuples are sequences, just like lists. The differences between tuples and lists...
Read more >
Python Tuples - GeeksforGeeks
In Python, tuples are created by placing a sequence of values separated by 'comma' with or without the use of parentheses for grouping...
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