Use of outer type argument in extension inline unapply(Seq) method causes compiler error
See original GitHub issueCompiler version
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:
- Created a year ago
- Comments:5 (1 by maintainers)
Top 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 >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
@rmgk That’s a different side of the same issue, see #8577 Both should eventually be resolved by #15191
Compiler version: 3.2.0-RC1-bin-20220514-bb29e20-NIGHTLY