Skip to content

represent FlexibleType using AppliedType - #27004

Open
olhotak wants to merge 12 commits into
scala:mainfrom
dotty-staging:rebased-simplified-26245
Open

olhotak wants to merge 12 commits into
scala:mainfrom
dotty-staging:rebased-simplified-26245

Conversation

@olhotak

@olhotak olhotak commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This is a rebased version of #26245. It also removes the unrelated and now-outdated changes that enable explicit nulls by default, to make the changes for the representation of FlexibleType more clearly visible.

Have you relied on LLM-based tools in this contribution?

No

How was the solution tested?

Covered by existing tests (this is a refactoring)

override final def baseClasses(using Context): List[ClassSymbol] = hi.baseClasses
}
// override final def baseClasses(using Context): List[ClassSymbol] = hi.baseClasses
// }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover comments.

// It is not necessary according to the use cases, so we choose to use a simpler
// rule.

def unapply(tp: Type)(using Context): Option[Type] = tp match

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def unapply(tp: Type)(using Context): Option[Type] = tp match
def unapply(tp: AppliedType)(using Context): Option[Type] = tp match

HarrisL2 and others added 12 commits September 9, 2026 09:11
Inside QuotesImpl the opaque `type FlexibleType = Types.AppliedType` is
transparent, so `case FlexibleType(tp)` type-tests against AppliedType and
matched any applied type. Returning `Some(...)` unconditionally then made the
pattern irrefutable, and the inner `.get` threw NoSuchElementException for
non-flexible applied types (e.g. List[Int], Option[String]) in
TypeReprMethods.typeArgs.

Quotes.scala already declares this as `Option[TypeRepr]`, so returning the
dotc-level result directly is both simpler and within the published API.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@olhotak
olhotak force-pushed the rebased-simplified-26245 branch from d271d39 to 6a06a7d Compare September 9, 2026 07:20
@olhotak
olhotak marked this pull request as ready for review September 10, 2026 06:40
@olhotak
olhotak requested a review from odersky September 10, 2026 06:40
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.

3 participants