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

Make aliases of MatchAliases normal TypeAliases #19871

Merged
merged 5 commits into from
Apr 8, 2024

Commits on Apr 3, 2024

  1. Normalize types before collecting parts determining implicit scope

    This is necessary to ensure the implicit scope is consistent when involving match types, since they may or may not have been reduced before implicit search.
    We can for example get different results when loading from tasty than when in the same run.
    
    Fixes scala#20071
    EugeneFlesselle committed Apr 3, 2024
    Configuration menu
    Copy the full SHA
    90c3fbd View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2024

  1. Make aliases of MatchAliases normal TypeAliases

    Make `isMatch` false for applied `MatchAlias`es,
    i.e. true only for `MatchType`s and higher-kinded abstraction of them.
    
    As a result, code using `isMatch` to choose between a `TypeAlias` and `MatchAlias`
    will now use a `TypeAlias` when aliasing a `MatchAlias`.
    Which in turn allows for better de-aliasing, since `dealias` only de-aliases standard type aliases.
    The logic for this distinction has also been extracted to the common `AliasingBounds` supertype.
    
    `tryNormalize` on `AppliedType`s should only attempt reduction if there is an underlying match type.
    This could previously be identified by a `MatchAlias` tycon. We now need a recursive check.
    EugeneFlesselle committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    ef7db7a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    259a16c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    389f5be View commit details
    Browse the repository at this point in the history
  4. Cache underlyingMatchType for AppliedTypes

    `def underlyingMatchType` had an `isMatchAlias` guard for `AppliedType`s.
    This used to be a quick check preventing unnecessary recursions and superType computations.
    
    But `isMatchAlias` is now itself mutually recursive with `underlyingMatchType`,
    so we cache it for AppliedTypes to alleviate this.
    EugeneFlesselle committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    1dc5b99 View commit details
    Browse the repository at this point in the history