Skip to content

Conversation

@soronpo
Copy link
Contributor

@soronpo soronpo commented Sep 16, 2021

Fixes #12656

@soronpo
Copy link
Contributor Author

soronpo commented Sep 16, 2021

@nicolasstucki I get a pickling test diff:

***** before-pickling.txt
                    <
                      <[ : scala.compiletime.testing.Error]:scala.Array[scala.compiletime.testing.Error]>@
                        tests\run\i12656.scala<108..108>
***** AFTER-PICKLING.TXT
                    <
                      <[ : scala.compiletime.testing.Error]:Seq[scala.compiletime.testing.Error]>@
                        tests\run\i12656.scala<108..108>
*****

Not sure what to do with this.

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Sep 16, 2021

You can add it to compiler/test/dotc/run-test-pickling.blacklist for now. It might be good to open another issue on this. It does require investigation.

@soronpo
Copy link
Contributor Author

soronpo commented Sep 17, 2021

I've discovered that this issue hid another bug. It seems that when an implicit macro issues an error message, a non-transparent inline function wrapper fails to pick it up. If the function is transparent, then it works as expected:

trait MacroErr
object MacroErr:
  import scala.quoted.*
  inline given MacroErr = ${ macroErr }
  def macroErr(using Quotes): Expr[MacroErr] =
    import quotes.reflect.*
    '{ compiletime.error("some macro error") }
inline def expectCompileError(
  inline code: String,
  expectedMsg: String
) =
  val errors = compiletime.testing.typeCheckErrors(code)
  assert(errors.head.message == expectedMsg, (errors.head.message, expectedMsg))

@main def Test = expectCompileError("""summon[MacroErr]""", "some macro error")
Exception in thread "main" java.lang.AssertionError: assertion failed: (no implicit argument of type MacroErr was found for parameter x of method summon in object Predef.
I found:

    MacroErr.given_MacroErr

But given instance given_MacroErr in object MacroErr does not match type MacroErr.,some macro error)

What do you think @nicolasstucki, should I file this as a separate issue and we let this one be merged as-is, or should we investigate further why non-transparent inline method wrappers fail in this particular area?

@nicolasstucki
Copy link
Contributor

File it as a separate issue.

@soronpo
Copy link
Contributor Author

soronpo commented Oct 5, 2021

Can we merge this?

@nicolasstucki nicolasstucki merged commit c5aac05 into scala:master Oct 5, 2021
@Kordyjan Kordyjan added this to the 3.1.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrapped typeCheckErrors is emitting compilation errors

3 participants