Skip to content

-Ycheck:inlinedPositions failure with Tuples and multiple inlined calls #6507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
milessabin opened this issue May 14, 2019 · 1 comment · Fixed by #11031
Closed

-Ycheck:inlinedPositions failure with Tuples and multiple inlined calls #6507

milessabin opened this issue May 14, 2019 · 1 comment · Fixed by #11031

Comments

@milessabin
Copy link
Contributor

The simplest reproduction I could come up with,

object Test {
  inline def s1 = 47 *: s2

  inline def s2 = 48 *: s3

  inline def s3 = 49 *: ()

  s1
}

fails with,

java.lang.AssertionError: assertion failed: wrong source set for 49 # 1264 of class dotty.tools.dotc.ast.Trees$Literal, set to tests/pos/ixxxx.scala but context had /home/miles/projects/dotty/library/src-3.x/scala/Tuple.scala while compiling tests/pos/ixxxx.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: wrong source set for 49 # 1264 of class dotty.tools.dotc.ast.Trees$Literal, set to tests/pos/ixxxx.scala but context had /home/miles/projects/dotty/library/src-3.x/scala/Tuple.scala

The original was a (fairly simple) recursive case,

import scala.compiletime._

object Test {
  inline def summonValues[T] <: Tuple = inline erasedValue[T] match {
    case _: Unit => ()
    case _: (a *: b) => constValue[a] *: summonValues[b]
  }

  summonValues[(96, 97, 98)]
}

which fails similarly with,

java.lang.AssertionError: assertion failed: wrong source set for 98 # 1605 of class dotty.tools.dotc.ast.Trees$Literal, set to tests/pos/ixxxx.scala but context had /home/miles/projects/dotty/library/src-3.x/scala/Tuple.scala while compiling tests/pos/ixxxx.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: wrong source set for 98 # 1605 of class dotty.tools.dotc.ast.Trees$Literal, set to tests/pos/ixxxx.scala but context had /home/miles/projects/dotty/library/src-3.x/scala/Tuple.scala
@nicolasstucki nicolasstucki removed their assignment Jan 27, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue May 12, 2020
anatoliykmetyuk added a commit that referenced this issue May 12, 2020
@nicolasstucki
Copy link
Contributor

Updated version

import scala.compiletime._

object Test {
  transparent inline def summonValues[T]: Tuple = inline erasedValue[T] match {
    case _: EmptyTuple => EmptyTuple
    case _: (a *: b) => constValue[a] *: summonValues[b]
  }

  summonValues[(96, 97, 98)]
}

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 7, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants