Skip to content

Conversation

@smarter
Copy link
Member

@smarter smarter commented Apr 8, 2017

Previously we believed that reducing type applications did not affect
type inference as long as the reduced type constructor had the same
arity as the unreduced one, for example reducing Foo[X, Y] is fine
when Foo is defined as:

type Foo[A, B] = Bar[A, B]

but not when it's defined as:

type Foo[A] = Bar[A, A]

But this is not a sufficient condition: the bounds of the type
constructor arguments also matter for type inference, so we need to be
more strict and disallow reductions in cases like:

type Foo[A, B] = Bar[B, A]

and:

type Foo[A, B] = Bar[A, Int]

… inference

Previously we believed that reducing type applications did not affect
type inference as long as the reduced type constructor had the same
arity as the unreduced one, for example reducing `Foo[X, Y]` is fine
when `Foo` is defined as:

type Foo[A, B] = Bar[A, B]

but not when it's defined as:

type Foo[A] = Bar[A, A]

But this is not a sufficient condition: the bounds of the type
constructor arguments also matter for type inference, so we need to be
more strict and disallow reductions in cases like:

type Foo[A, B] = Bar[B, A]

and:

type Foo[A, B] = Bar[A, Int]
@odersky
Copy link
Contributor

odersky commented Apr 9, 2017

LGTM

@odersky odersky merged commit b8bb34d into scala:master Apr 9, 2017
@allanrenucci allanrenucci deleted the fix/i2201 branch December 14, 2017 19:22
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.

2 participants