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 of outer type argument in extension inline unapply(Seq) method causes compiler error

See original GitHub issue

Compiler version

#15053

Minimized code

object O

extension [T] (ctx: O.type) inline def unapplySeq(input: T): Option[Seq[T]] = Some(Seq(input)) 

@main
def Main = {
  val O(x) = 3
  println(s"x: $x")
}

Output

Compiler error

Exception in thread "main" java.lang.IndexOutOfBoundsException: 0
        at scala.collection.LinearSeqOps.apply(LinearSeq.scala:117)
        at scala.collection.LinearSeqOps.apply$(LinearSeq.scala:114)
        at scala.collection.immutable.List.apply(List.scala:79)
        at dotty.tools.dotc.core.Substituters$.substParams(Substituters.scala:151)
        at dotty.tools.dotc.core.Substituters$SubstParamsMap.apply(Substituters.scala:197)
        at dotty.tools.dotc.core.Substituters$SubstParamsMap.apply(Substituters.scala:197)
        at scala.collection.immutable.List.mapConserve(List.scala:472)
        at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5553)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5582)
        at dotty.tools.dotc.core.Substituters$.substParams(Substituters.scala:161)
        at dotty.tools.dotc.core.Substituters$SubstParamsMap.apply(Substituters.scala:197)
        at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda(Types.scala:5555)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5582)
        at dotty.tools.dotc.core.Substituters$.substParams(Substituters.scala:161)
        ...

Expectation

x: 3

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gorilskijcommented, Jul 2, 2022

@rmgk That’s a different side of the same issue, see #8577 Both should eventually be resolved by #15191

1reaction
prolativcommented, May 16, 2022

Compiler version: 3.2.0-RC1-bin-20220514-bb29e20-NIGHTLY

Read more comments on GitHub >

github_iconTop Results From Across the Web

4. Pattern Matching - Programming Scala, 2nd Edition [Book]
From the type of the list, the compiler knows that there are two possible cases, true and false . So, it warns that...
Read more >
Compiler Warnings by compiler version | Microsoft Learn
This option only suppresses warnings, not new error messages. Don't suppress all new warnings permanently! We recommend you always compile at ...
Read more >
What is an undefined reference/unresolved external symbol ...
I just came across another possible reason for the unresolved symbol compiler error. A function was originally defined as inline inside a header,...
Read more >
List of the armcc error and warning messages - Arm Developer
The ARM Compiler Errors and Warnings Reference Guide provides lists of the errors and warnings that each of the compilation tools can generate....
Read more >
Warning Options (Using the GNU Compiler Collection (GCC))
This option causes the compiler to abort compilation on the first error ... certain GNU extensions and traditional C and C++ features are...
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