Skip to content
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

FlexibleTypes are not handled in Quotes #20287

Closed
WojciechMazur opened this issue Apr 29, 2024 · 1 comment · Fixed by #20293
Closed

FlexibleTypes are not handled in Quotes #20287

WojciechMazur opened this issue Apr 29, 2024 · 1 comment · Fixed by #20293
Assignees
Labels
area:metaprogramming:quotes Issues related to quotes and splices area:nullability itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@WojciechMazur
Copy link
Contributor

Issue found in OpenCB for scalacenter/tasty-mima - build logs

Compiler version

3.5.0-RC1-bin-20240417-b93c337-NIGHTLY

Minimized code

Not minimized yet

Output

Error:  -- Error: /build/repo/tasty-mima/src/test/scala/tastymima/intf/ProblemSuite.scala:41:18 
Error:  41 |      assert(clue(TestProblem(kind, "<path-string>").getFilterIncantation()) == clue(expected))
Error:     |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error:     |Exception occurred while executing macro expansion.
Error:     |scala.MatchError: FlexibleType(OrType(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Null)),TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)) (of class dotty.tools.dotc.core.Types$FlexibleType)
Error:     |	at scala.quoted.runtime.impl.printers.Extractors$ExtractorsPrinter.visitType(Extractors.scala:241)
Error:     |	at scala.quoted.runtime.impl.printers.Extractors$.showType(Extractors.scala:12)
Error:     |	at scala.quoted.runtime.impl.QuotesImpl$$anon$19.show(QuotesImpl.scala:3219)
Error:     |	at scala.quoted.runtime.impl.QuotesImpl$$anon$19.show(QuotesImpl.scala:3218)
Error:     |	at scala.quoted.runtime.impl.QuotesImpl$reflect$TypeReprMethods$.show(QuotesImpl.scala:1804)
Error:     |	at scala.quoted.runtime.impl.QuotesImpl$reflect$TypeReprMethods$.show(QuotesImpl.scala:1804)
Error:     |	at scala.quoted.runtime.impl.printers.SourceCode$SourceCodePrinter.printType(SourceCode.scala:1251)
Error:     |	at scala.quoted.runtime.impl.printers.SourceCode$SourceCodePrinter.printTypeAndAnnots$1(SourceCode.scala:1020)
Error:     |	at scala.quoted.runtime.impl.printers.SourceCode$SourceCodePrinter.printTypeTree(SourceCode.scala:1022)
Error:     |	at scala.quoted.runtime.impl.printers.SourceCode$SourceCodePrinter.printTree(SourceCode.scala:527)
Error:     |	at scala.quoted.runtime.impl.printers.SourceCode$.showTree(SourceCode.scala:10)
Error:     |	at scala.quoted.runtime.impl.QuotesImpl$$anon$13.show(QuotesImpl.scala:3195)
Error:     |	at scala.quoted.runtime.impl.QuotesImpl$$anon$13.show(QuotesImpl.scala:3194)
Error:     |	at scala.quoted.runtime.impl.QuotesImpl$reflect$TreeMethods$.show(QuotesImpl.scala:108)
Error:     |	at scala.quoted.runtime.impl.QuotesImpl$reflect$TreeMethods$.show(QuotesImpl.scala:108)
Error:     |	at munit.internal.MacroCompat$.clueImpl(MacroCompat.scala:31)
Error:     |
Error:     |----------------------------------------------------------------------------
Error:     |Inline stack trace
Error:     |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Error:     |This location contains code that was inlined from MacroCompat.scala:24
Error:      ----------------------------------------------------------------------------```

Expectation

Audit and fix the corner cases where FlexibleType might lead to MatchError

@WojciechMazur WojciechMazur added itype:bug regression This worked in a previous version but doesn't anymore area:metaprogramming:quotes Issues related to quotes and splices labels Apr 29, 2024
@noti0na1
Copy link
Member

To fix the missing case, we have to add flexible types to Quotes library.

noti0na1 added a commit that referenced this issue May 6, 2024
Fix #20287: Add flexible types to `Quotes` library.
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:quotes Issues related to quotes and splices area:nullability itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants