RFR: universal type variables: initial prototype

Vicente Romero vromero at openjdk.java.net
Thu Aug 5 04:26:49 UTC 2021


On Wed, 4 Aug 2021 10:20:30 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> First iteration of the protype for universal type variables
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 1089:
> 
>> 1087:             } else if (isSubtype(t, s, capture)) {
>> 1088:                 return true;
>> 1089:             } else if (allowUniversalTVars && t.hasTag(TYPEVAR) && s.hasTag(TYPEVAR) && t.tsym == s.tsym) {
> 
> Are you sure the check does what the comment says?

will remove the comment, probably a self comment I guess

> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 3615:
> 
>> 3613:                     return to.head.withTypeVar(t);
>> 3614:                 }
>> 3615:                 if (allowUniversalTVars &&
> 
> Not sure about this - the main issue here seems that `t.equalsIgnoreMetadata` is too weak and would return `false` for `ref` vs.`val` mismatches. But again I'm uncertain about the need of overriding `withTypeVar` (see comment above).

not sure I follow you here, `t.equalsIgnoreMetadata` is already being used in the method, not sure I see in what case it can give an incorrect answer

-------------

PR: https://git.openjdk.java.net/valhalla/pull/521



More information about the valhalla-dev mailing list