more specific method inference
Dan Smith
daniel.smith at oracle.com
Thu Dec 19 16:36:46 PST 2013
On Dec 19, 2013, at 5:09 PM, Rafkind, Jon <jon.rafkind at hp.com> wrote:
>> 'Integer' appears in incorporation: Q <: Number because Q extends Integer.
>
> Is this because a type variable counts as a proper type?
Yes. Both Q and Number are proper types, so "the constraint reduces to true if S is a subtype of T (4.10), and false otherwise." Just vanilla subtyping.
> I should have
> been more clear about my confusion. 18.2.3 explicitly mentions T can be
> a type variable in (S <: T) but does not say S can be a type variable.
> The only case that seems to allow S to be a type variable is the first case
>
> If S and T are proper types, the constraint reduces to true if S is a
> subtype of T (4.10), and false otherwise.
>
> If so, then it seems the first case would subsume some cases that are
> supposed to be handled by the case starting with "If T is a type
> variable..."
If T is a type variable, then in all subsequent cases, S is not a proper type. S might be an inference variable, or a parameterized type Foo<alpha>, or an array type, or ...
If S is a type variable and T is not a proper type, then any of the rules involving "the supertypes of S" may apply.
—Dan
More information about the lambda-spec-observers
mailing list