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

Fix #401: Avoid asSeenFrom for types/bounds that don't depend on the prefix. #404

Merged
merged 3 commits into from
Nov 30, 2023

Commits on Nov 29, 2023

  1. Configuration menu
    Copy the full SHA
    8cd5141 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b9dda99 View commit details
    Browse the repository at this point in the history
  3. Fix scalacenter#401: Avoid asSeenFrom for types/bounds that don't dep…

    …end on the prefix.
    
    This mostly acts as a fast path. However, for the particular case
    of static recursive match types, it more critically cuts some
    infinite recursion.
    
    Normally, when a match type refers to itself, it would do so
    through a `ThisType`. Computing `asSeenFrom` for a `ThisType`
    prefix already cuts the infinite recursion because it is, by
    construction, a no-op.
    
    However, for static recursive match types, the compiler makes them
    refer to themselves through their public, static prefix. This
    caused the infinite recursion observed in scalacenter#401.
    
    To avoid the issue, we use another shortcut to `asSeenFrom`: if
    the type we map over does not contain any `ThisType`, we also
    know it will be a no-op. We store that as a lazy val
    `isPrefixDependent` of `TermSymbol` and `TypeMemberSymbol`, so
    that they can take a short cut in `{type,bounds}AsSeenFrom`.
    sjrd committed Nov 29, 2023
    Configuration menu
    Copy the full SHA
    060847e View commit details
    Browse the repository at this point in the history