Skip to content

Backport "Patmat: Use less type variables in prefix inference" #17440

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

Merged
merged 1 commit into from
May 9, 2023

Conversation

prolativ
Copy link
Contributor

@prolativ prolativ commented May 9, 2023

Backports #16827

Solves #17368

In code like:

    class Outer:
      sealed trait Foo
      case class Bar() extends Foo

      def mat(foo: Foo) = foo match
        case Bar() =>

When in the course of decomposing the scrutinee's type, which is
`Outer.this.Foo`, we're trying to instantiate subclass `Outer.this.Bar`,
the `Outer.this` is fixed - it needn't be inferred, via type variables
and type bounds.  Cutting down on type variables, particularly when GADT
symbols are also present, can really speed up the operation, including
making code that used to hang forever compile speedily.
@Kordyjan Kordyjan enabled auto-merge May 9, 2023 10:44
@Kordyjan Kordyjan merged commit 752ad2f into scala:release-3.3.0 May 9, 2023
@Kordyjan Kordyjan deleted the backport-16827 branch May 9, 2023 11:16
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