Fehlende Constraints beim Pattern-Matching mit Generics #353

Closed
opened 2024-11-21 14:48:49 +00:00 by dholle · 10 comments
Owner

Siehe Test hier: 158adf837a/resources/bytecode/javFiles/PatternMatchingListAppend.jav

AST (Relevanter Teil):

PatternMatchingListAppend()({
  })::TPH BN
  TPH AQ append(Cons<TPH AT>(TPH AR a, TPH AS b), TPH AU list2)({
    return new Cons((a)::TPH AR, ((this)::TPH AW.append Signature: [TPH AX, TPH AY, TPH AZ]((b)::TPH AS, (list2)::TPH AU))::TPH BA);
  })::TPH BF

  TPH BG append(Empty<TPH BH>(), TPH BI list2)({
    return (list2)::TPH BI;
  })::TPH BJ

  PatternMatchingListAppend()({
    super(()) Signature: [TPH BL];
  })::TPH BM

}

Result Set:

RESULT Final: [[(TPH BE = Cons<GTV T>), (TPH ABQ, TPH AEB), (TPH AC = Cons<GTV T>), (TPH AY, TPH AU), (TPH AEG = GTV T), (TPH AS = ? extends Cons<TPH AEC>), (TPH AQ = Cons<TPH AEB>), (TPH AA = Cons<GTV T>), (TPH BD = List<GTV T>), (TPH ABO = GTV T), (TPH AR < TPH AEB), (TPH BA = Cons<TPH AEB>), (TPH AW = PatternMatchingListAppend), (TPH AZ = Cons<TPH AEB>), (TPH AX = Cons<TPH AEC>), (TPH AEF, TPH AEC), (TPH ABM = GTV T), (TPH AED, TPH AEB), (TPH BI < TPH BG), (TPH BC = GTV T), (TPH AEE = GTV T)], [(TPH AEN = GTV T), (TPH BG = Cons<TPH AEJ>), (TPH ABO = GTV T), (TPH BA = Cons<TPH AEJ>), (TPH AER, TPH AEJ), (TPH AY = Cons<TPH AEJ>), (TPH ABQ, TPH AEJ), (TPH AS = ? extends Empty<TPH AEH>), (TPH AA = Cons<GTV T>), (TPH ABM = GTV T), (TPH BD = List<GTV T>), (TPH BC = GTV T), (TPH AC = Cons<GTV T>), (TPH AX = Empty<TPH AEH>), (TPH AEL, TPH AEH), (TPH AEP, TPH AEJ), (TPH AZ = Cons<TPH AEJ>), (TPH AEQ = GTV T), (TPH BI = Cons<TPH AEJ>), (TPH AU = Cons<TPH AEJ>), (TPH BE = Cons<GTV T>), (TPH AQ = Cons<TPH AEJ>), (TPH AR < TPH AEJ), (TPH AW = PatternMatchingListAppend)], [(TPH ABQ, TPH AEI), (TPH AS = ? extends Empty<TPH AEK>), (TPH BE = Cons<GTV T>), (TPH AQ = Cons<TPH AEI>), (TPH BI = Empty<TPH AEI>), (TPH BA = Empty<TPH AEI>), (TPH AX = Empty<TPH AEK>), (TPH AET = GTV T), (TPH AR < TPH AEI), (TPH BG = Empty<TPH AEI>), (TPH AA = Cons<GTV T>), (TPH AEU, TPH AEI), (TPH BD = List<GTV T>), (TPH AU = Empty<TPH AEI>), (TPH AC = Cons<GTV T>), (TPH ABO = GTV T), (TPH AY = Empty<TPH AEI>), (TPH BC = GTV T), (TPH ABM = GTV T), (TPH AES = GTV T), (TPH AW = PatternMatchingListAppend), (TPH AZ = Empty<TPH AEI>), (TPH AEM, TPH AEI), (TPH AEO, TPH AEK)]]

AR bekommt bei mir keinen Typ.

Siehe Test hier: https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore/src/commit/158adf837a7a34284c5f19b61631a35a049c2603/resources/bytecode/javFiles/PatternMatchingListAppend.jav AST (Relevanter Teil): ``` PatternMatchingListAppend()({ })::TPH BN TPH AQ append(Cons<TPH AT>(TPH AR a, TPH AS b), TPH AU list2)({ return new Cons((a)::TPH AR, ((this)::TPH AW.append Signature: [TPH AX, TPH AY, TPH AZ]((b)::TPH AS, (list2)::TPH AU))::TPH BA); })::TPH BF TPH BG append(Empty<TPH BH>(), TPH BI list2)({ return (list2)::TPH BI; })::TPH BJ PatternMatchingListAppend()({ super(()) Signature: [TPH BL]; })::TPH BM } ``` Result Set: ``` RESULT Final: [[(TPH BE = Cons<GTV T>), (TPH ABQ, TPH AEB), (TPH AC = Cons<GTV T>), (TPH AY, TPH AU), (TPH AEG = GTV T), (TPH AS = ? extends Cons<TPH AEC>), (TPH AQ = Cons<TPH AEB>), (TPH AA = Cons<GTV T>), (TPH BD = List<GTV T>), (TPH ABO = GTV T), (TPH AR < TPH AEB), (TPH BA = Cons<TPH AEB>), (TPH AW = PatternMatchingListAppend), (TPH AZ = Cons<TPH AEB>), (TPH AX = Cons<TPH AEC>), (TPH AEF, TPH AEC), (TPH ABM = GTV T), (TPH AED, TPH AEB), (TPH BI < TPH BG), (TPH BC = GTV T), (TPH AEE = GTV T)], [(TPH AEN = GTV T), (TPH BG = Cons<TPH AEJ>), (TPH ABO = GTV T), (TPH BA = Cons<TPH AEJ>), (TPH AER, TPH AEJ), (TPH AY = Cons<TPH AEJ>), (TPH ABQ, TPH AEJ), (TPH AS = ? extends Empty<TPH AEH>), (TPH AA = Cons<GTV T>), (TPH ABM = GTV T), (TPH BD = List<GTV T>), (TPH BC = GTV T), (TPH AC = Cons<GTV T>), (TPH AX = Empty<TPH AEH>), (TPH AEL, TPH AEH), (TPH AEP, TPH AEJ), (TPH AZ = Cons<TPH AEJ>), (TPH AEQ = GTV T), (TPH BI = Cons<TPH AEJ>), (TPH AU = Cons<TPH AEJ>), (TPH BE = Cons<GTV T>), (TPH AQ = Cons<TPH AEJ>), (TPH AR < TPH AEJ), (TPH AW = PatternMatchingListAppend)], [(TPH ABQ, TPH AEI), (TPH AS = ? extends Empty<TPH AEK>), (TPH BE = Cons<GTV T>), (TPH AQ = Cons<TPH AEI>), (TPH BI = Empty<TPH AEI>), (TPH BA = Empty<TPH AEI>), (TPH AX = Empty<TPH AEK>), (TPH AET = GTV T), (TPH AR < TPH AEI), (TPH BG = Empty<TPH AEI>), (TPH AA = Cons<GTV T>), (TPH AEU, TPH AEI), (TPH BD = List<GTV T>), (TPH AU = Empty<TPH AEI>), (TPH AC = Cons<GTV T>), (TPH ABO = GTV T), (TPH AY = Empty<TPH AEI>), (TPH BC = GTV T), (TPH ABM = GTV T), (TPH AES = GTV T), (TPH AW = PatternMatchingListAppend), (TPH AZ = Empty<TPH AEI>), (TPH AEM, TPH AEI), (TPH AEO, TPH AEK)]] ``` AR bekommt bei mir keinen Typ.
dholle added the
Unify
label 2024-11-21 14:48:49 +00:00
pl was assigned by dholle 2024-11-21 14:49:13 +00:00
RubenKraft was assigned by dholle 2024-11-21 14:49:13 +00:00
Owner

Hallo Daniel,
k
önntest Du auch noch das Constraint-Set dazu posten. Dann kann man erkennen, ob es überhaupt einen Constraint für AR gibt.

Danke
Martin

Hallo Daniel, k önntest Du auch noch das Constraint-Set dazu posten. Dann kann man erkennen, ob es überhaupt einen Constraint für AR gibt. Danke Martin
Author
Owner

Hier ist der Rest vom output:

Unify nach Oder-Constraints-Anpassung:
UND:[(List<T> <. List<T>, )@6 in PatternMatchingListAppend.jav, (java.lang.Record =. java.lang.Record, ), (T <. T, )@6 in PatternMatchingListAppend.jav, (java.lang.Object =. java.lang.Object, ), (AW =. PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (Cons<AV> <. AQ, , -1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav, (AA =. Cons<T>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav, (AC =. Cons<T>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav, (BI <. BG, 1 WC: false, IT: false, -1 WC: false, IT: false)@16 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[]

ODER:
[[(T =. ABL, , 0 WC: true, IT: true)@6 in PatternMatchingListAppend.jav, (AA <. Cons<ABL>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[]
]
[[(List<T> =. List<ABM>, )@6 in PatternMatchingListAppend.jav, (AC <. Cons<ABM>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[]
]
[]
[[(T =. ABN, , 0 WC: true, IT: true)@6 in PatternMatchingListAppend.jav, (AA <. Cons<ABN>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[]
]
[[(List<T> =. List<ABO>, )@6 in PatternMatchingListAppend.jav, (AC <. Cons<ABO>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[]
]
[]
[[(AS <. Empty<BH>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (BG <. BA, -1 WC: false, IT: false, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AW =. ? extends PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AU <. BI, 1 WC: false, IT: false, 1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[(AZ =. BG, 0 WC: true, IT: false, -1 WC: false, IT: false), (AY =. BI, 0 WC: true, IT: false, 1 WC: false, IT: false), (AX =. Empty<BH>, 0 WC: true, IT: false)]
, [(AU <. AU, 1 WC: false, IT: false, 1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav, (AW =. ? extends PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AS <. Cons<AT>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AQ <. BA, -1 WC: false, IT: false, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[(AZ =. AQ, 0 WC: true, IT: false, -1 WC: false, IT: false), (AX =. Cons<AT>, 0 WC: true, IT: false), (AY =. AU, 0 WC: true, IT: false, 1 WC: false, IT: false)]
, [(AU <. AU, 1 WC: false, IT: false, 1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav, (AW =. PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AS <. Cons<AT>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AQ <. BA, -1 WC: false, IT: false, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[(AZ =. AQ, 0 WC: true, IT: false, -1 WC: false, IT: false), (AX =. Cons<AT>, 0 WC: true, IT: false), (AY =. AU, 0 WC: true, IT: false, 1 WC: false, IT: false)]
, [(AS <. Empty<BH>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (BG <. BA, -1 WC: false, IT: false, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AW =. PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AU <. BI, 1 WC: false, IT: false, 1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[(AZ =. BG, 0 WC: true, IT: false, -1 WC: false, IT: false), (AY =. BI, 0 WC: true, IT: false, 1 WC: false, IT: false), (AX =. Empty<BH>, 0 WC: true, IT: false)]
]
[[(BE =. Cons<T>, 0 WC: true, IT: false), (BC =. T, 0 WC: true, IT: false), (AR <. ABP, 0 WC: true, IT: true, 0 WC: true, IT: true)@12 in PatternMatchingListAppend.jav, (BD =. List<T>, 0 WC: true, IT: false), (Cons<ABP> <. Cons<AV>, )@12 in PatternMatchingListAppend.jav, (BA <. List<ABP>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav]
isInherited = false isOveridden = false[(BE =. Cons<T>, 0 WC: true, IT: false), (BC =. T, 0 WC: true, IT: false), (BD =. List<T>, 0 WC: true, IT: false)]
]
[]
Hier ist der Rest vom output: ``` Unify nach Oder-Constraints-Anpassung: UND:[(List<T> <. List<T>, )@6 in PatternMatchingListAppend.jav, (java.lang.Record =. java.lang.Record, ), (T <. T, )@6 in PatternMatchingListAppend.jav, (java.lang.Object =. java.lang.Object, ), (AW =. PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (Cons<AV> <. AQ, , -1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav, (AA =. Cons<T>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav, (AC =. Cons<T>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav, (BI <. BG, 1 WC: false, IT: false, -1 WC: false, IT: false)@16 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[] ODER: [[(T =. ABL, , 0 WC: true, IT: true)@6 in PatternMatchingListAppend.jav, (AA <. Cons<ABL>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[] ] [[(List<T> =. List<ABM>, )@6 in PatternMatchingListAppend.jav, (AC <. Cons<ABM>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[] ] [] [[(T =. ABN, , 0 WC: true, IT: true)@6 in PatternMatchingListAppend.jav, (AA <. Cons<ABN>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[] ] [[(List<T> =. List<ABO>, )@6 in PatternMatchingListAppend.jav, (AC <. Cons<ABO>, 0 WC: true, IT: false)@6 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[] ] [] [[(AS <. Empty<BH>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (BG <. BA, -1 WC: false, IT: false, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AW =. ? extends PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AU <. BI, 1 WC: false, IT: false, 1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[(AZ =. BG, 0 WC: true, IT: false, -1 WC: false, IT: false), (AY =. BI, 0 WC: true, IT: false, 1 WC: false, IT: false), (AX =. Empty<BH>, 0 WC: true, IT: false)] , [(AU <. AU, 1 WC: false, IT: false, 1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav, (AW =. ? extends PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AS <. Cons<AT>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AQ <. BA, -1 WC: false, IT: false, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[(AZ =. AQ, 0 WC: true, IT: false, -1 WC: false, IT: false), (AX =. Cons<AT>, 0 WC: true, IT: false), (AY =. AU, 0 WC: true, IT: false, 1 WC: false, IT: false)] , [(AU <. AU, 1 WC: false, IT: false, 1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav, (AW =. PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AS <. Cons<AT>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AQ <. BA, -1 WC: false, IT: false, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[(AZ =. AQ, 0 WC: true, IT: false, -1 WC: false, IT: false), (AX =. Cons<AT>, 0 WC: true, IT: false), (AY =. AU, 0 WC: true, IT: false, 1 WC: false, IT: false)] , [(AS <. Empty<BH>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (BG <. BA, -1 WC: false, IT: false, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AW =. PatternMatchingListAppend, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav, (AU <. BI, 1 WC: false, IT: false, 1 WC: false, IT: false)@12 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[(AZ =. BG, 0 WC: true, IT: false, -1 WC: false, IT: false), (AY =. BI, 0 WC: true, IT: false, 1 WC: false, IT: false), (AX =. Empty<BH>, 0 WC: true, IT: false)] ] [[(BE =. Cons<T>, 0 WC: true, IT: false), (BC =. T, 0 WC: true, IT: false), (AR <. ABP, 0 WC: true, IT: true, 0 WC: true, IT: true)@12 in PatternMatchingListAppend.jav, (BD =. List<T>, 0 WC: true, IT: false), (Cons<ABP> <. Cons<AV>, )@12 in PatternMatchingListAppend.jav, (BA <. List<ABP>, 0 WC: true, IT: false)@12 in PatternMatchingListAppend.jav] isInherited = false isOveridden = false[(BE =. Cons<T>, 0 WC: true, IT: false), (BC =. T, 0 WC: true, IT: false), (BD =. List<T>, 0 WC: true, IT: false)] ] [] ```
Owner

Hallo Ruben,

hier scheint es noch ein grundsätzliches Problem zu geben vermutlich GTV und TPH. Das muss ich mir bzw. wir zusmmen genauer anschauen.
Biite vormerken für den 6.12.

Viele Grüße
Martin

Hallo Ruben, hier scheint es noch ein grundsätzliches Problem zu geben vermutlich GTV und TPH. Das muss ich mir bzw. wir zusmmen genauer anschauen. Biite vormerken für den 6.12. Viele Grüße Martin
Collaborator

Hi Martin,

Japp, ich wollte mir das diese Woche mal noch anschauen, vielleicht finde ich das Problem auch direkt.
Ich schreib es mir mal für den 6. auf.

Gruß

Hi Martin, Japp, ich wollte mir das diese Woche mal noch anschauen, vielleicht finde ich das Problem auch direkt. Ich schreib es mir mal für den 6. auf. Gruß
Author
Owner

Ich glaube ich hatte damals gesagt man kann einfach den TPH aus der Klasse rausziehen, aber das funktioniert für GTVs so scheinbar nicht?

Ich glaube ich hatte damals gesagt man kann einfach den TPH aus der Klasse rausziehen, aber das funktioniert für GTVs so scheinbar nicht?
Owner

Was meinst Du mit rausziehen. Mach mal ein Beispiel

Was meinst Du mit rausziehen. Mach mal ein Beispiel
Author
Owner

Der Code ist hier:

constraintsSet.addUndConstraint(new Pair(subPattern.getType(), con.getParameterList().getParameterAt(counter).getType(), PairOperator.SMALLERDOT, loc(con.getParameterList().getParameterAt(counter).getOffset())));

Für die Record parameter wird die Liste der Klassen durchsucht und dann ein UND constraint über die Parameter-Typen im Standardkonstruktor erstellt. Das ist hier wahrscheinlich dieses ominöse TPH AEB.

Der Code ist hier: https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore/src/commit/f0287c46115e3d1b8970f6c8f185f86c53cdc5e1/src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java#L914 Für die Record parameter wird die Liste der Klassen durchsucht und dann ein UND constraint über die Parameter-Typen im Standardkonstruktor erstellt. Das ist hier wahrscheinlich dieses ominöse `TPH AEB`.
Author
Owner

Ich habe den Code nochmal angepasst, es liefert aber immernoch nicht das richtige Ergebnis.
Jetzt werden zwei neue Constraints generiert:

(Cons<AT> =. Cons<ABQ>), (AR <. ABQ)

Müsste jetzt nicht AR < AT herauskommen? AR bekommt bei mir weiterhin keinen Typ.

Hier ist das neue Resultset:

RESULT Final: [[(TPH AEL, TPH AEC), (TPH AEK = GTV T), (TPH AED, TPH AEC), (TPH BG = Empty<TPH AEC>), (TPH AY = Empty<TPH AEC>), (TPH AEJ = GTV T), (TPH AQ = Cons<TPH AEC>), (TPH AU = Empty<TPH AEC>), (TPH AS = ? extends Empty<TPH AEF>), (TPH ABO = GTV T), (TPH ABM = GTV T), (TPH BD = List<GTV T>), (TPH AR < TPH AEC), (TPH BA = Empty<TPH AEC>), (TPH BE = Cons<GTV T>), (TPH ABQ, TPH AEF), (TPH AEM, TPH AEF), (TPH AZ = Empty<TPH AEC>), (TPH BC = GTV T), (TPH AC = Cons<GTV T>), (TPH AEE, TPH AEF), (TPH AR < TPH AEF), (TPH BI = Empty<TPH AEC>), (TPH AX = Empty<TPH AEF>), (TPH ABR, TPH AEC), (TPH AA = Cons<GTV T>), (TPH AW = PatternMatchingListAppend)], [(TPH AR < TPH ABQ), (TPH AEE, TPH AED), (TPH AX = Empty<TPH ABQ>), (TPH AU = Cons<TPH AED>), (TPH AEG, TPH ABQ), (TPH AA = Cons<GTV T>), (TPH BI = Cons<TPH AED>), (TPH ABO = GTV T), (TPH AC = Cons<GTV T>), (TPH BA = Cons<TPH AED>), (TPH BE = Cons<GTV T>), (TPH AW = PatternMatchingListAppend), (TPH BG = Cons<TPH AED>), (TPH AEI, TPH ABQ), (TPH ABR, TPH AED), (TPH AEH, TPH AED), (TPH AQ = Cons<TPH AED>), (TPH AS = ? extends Empty<TPH ABQ>), (TPH AZ = Cons<TPH AED>), (TPH BD = List<GTV T>), (TPH BC = GTV T), (TPH AEH, TPH ABQ), (TPH AR < TPH AED), (TPH ABM = GTV T), (TPH AEF = GTV T), (TPH AY = Cons<TPH AED>), (TPH AEG = GTV T)], [(TPH AR < TPH ABQ), (TPH ABM = GTV T), (TPH AEN, TPH ABQ), (TPH BD = List<GTV T>), (TPH AY, TPH AU), (TPH AX = Cons<TPH ABQ>), (TPH AC = Cons<GTV T>), (TPH AEP = GTV T), (TPH BE = Cons<GTV T>), (TPH BC = GTV T), (TPH AQ = Cons<TPH AEO>), (TPH AER, TPH ABQ), (TPH AES = GTV T), (TPH BI < TPH BG), (TPH AR < TPH AEO), (TPH AZ = Cons<TPH AEO>), (TPH ABR, TPH AEO), (TPH ABO = GTV T), (TPH BA = Cons<TPH AEO>), (TPH AW = PatternMatchingListAppend), (TPH AS = ? extends Cons<TPH ABQ>), (TPH AA = Cons<GTV T>), (TPH AEQ, TPH AEO)]]
Ich habe den Code nochmal angepasst, es liefert aber immernoch nicht das richtige Ergebnis. Jetzt werden zwei neue Constraints generiert: ``` (Cons<AT> =. Cons<ABQ>), (AR <. ABQ) ``` Müsste jetzt nicht `AR < AT` herauskommen? `AR` bekommt bei mir weiterhin keinen Typ. Hier ist das neue Resultset: ``` RESULT Final: [[(TPH AEL, TPH AEC), (TPH AEK = GTV T), (TPH AED, TPH AEC), (TPH BG = Empty<TPH AEC>), (TPH AY = Empty<TPH AEC>), (TPH AEJ = GTV T), (TPH AQ = Cons<TPH AEC>), (TPH AU = Empty<TPH AEC>), (TPH AS = ? extends Empty<TPH AEF>), (TPH ABO = GTV T), (TPH ABM = GTV T), (TPH BD = List<GTV T>), (TPH AR < TPH AEC), (TPH BA = Empty<TPH AEC>), (TPH BE = Cons<GTV T>), (TPH ABQ, TPH AEF), (TPH AEM, TPH AEF), (TPH AZ = Empty<TPH AEC>), (TPH BC = GTV T), (TPH AC = Cons<GTV T>), (TPH AEE, TPH AEF), (TPH AR < TPH AEF), (TPH BI = Empty<TPH AEC>), (TPH AX = Empty<TPH AEF>), (TPH ABR, TPH AEC), (TPH AA = Cons<GTV T>), (TPH AW = PatternMatchingListAppend)], [(TPH AR < TPH ABQ), (TPH AEE, TPH AED), (TPH AX = Empty<TPH ABQ>), (TPH AU = Cons<TPH AED>), (TPH AEG, TPH ABQ), (TPH AA = Cons<GTV T>), (TPH BI = Cons<TPH AED>), (TPH ABO = GTV T), (TPH AC = Cons<GTV T>), (TPH BA = Cons<TPH AED>), (TPH BE = Cons<GTV T>), (TPH AW = PatternMatchingListAppend), (TPH BG = Cons<TPH AED>), (TPH AEI, TPH ABQ), (TPH ABR, TPH AED), (TPH AEH, TPH AED), (TPH AQ = Cons<TPH AED>), (TPH AS = ? extends Empty<TPH ABQ>), (TPH AZ = Cons<TPH AED>), (TPH BD = List<GTV T>), (TPH BC = GTV T), (TPH AEH, TPH ABQ), (TPH AR < TPH AED), (TPH ABM = GTV T), (TPH AEF = GTV T), (TPH AY = Cons<TPH AED>), (TPH AEG = GTV T)], [(TPH AR < TPH ABQ), (TPH ABM = GTV T), (TPH AEN, TPH ABQ), (TPH BD = List<GTV T>), (TPH AY, TPH AU), (TPH AX = Cons<TPH ABQ>), (TPH AC = Cons<GTV T>), (TPH AEP = GTV T), (TPH BE = Cons<GTV T>), (TPH BC = GTV T), (TPH AQ = Cons<TPH AEO>), (TPH AER, TPH ABQ), (TPH AES = GTV T), (TPH BI < TPH BG), (TPH AR < TPH AEO), (TPH AZ = Cons<TPH AEO>), (TPH ABR, TPH AEO), (TPH ABO = GTV T), (TPH BA = Cons<TPH AEO>), (TPH AW = PatternMatchingListAppend), (TPH AS = ? extends Cons<TPH ABQ>), (TPH AA = Cons<GTV T>), (TPH AEQ, TPH AEO)]] ```
Author
Owner

Das Problem waren die Generics und die genesteten Patterns, jetzt scheint es zu funktionieren:

    public <AU, ABQ, AEC extends ABQ> Cons<AEC> append(Cons<ABQ> var1, AU var2) 

    public <AEJ, BH> Empty<AEJ> append(Empty<BH> var1, Empty<AEJ> var2)

    public <AEO, AEQ extends AEO> Cons<AEQ> append(Cons<AEO> var1, Cons<AEQ> var2)

    public <BH, AEQ> Cons<AEQ> append(Empty<BH> var1, Cons<AEQ> var2)

    public <BI, BH> BI append(Empty<BH> var1, BI var2)

    public <AEJ extends ABQ, ABQ> Cons<AEJ> append(Cons<ABQ> var1, Empty<AEJ> var2)

@pl Sieht das richtig aus?

Das Problem waren die Generics und die genesteten Patterns, jetzt scheint es zu funktionieren: ``` public <AU, ABQ, AEC extends ABQ> Cons<AEC> append(Cons<ABQ> var1, AU var2) public <AEJ, BH> Empty<AEJ> append(Empty<BH> var1, Empty<AEJ> var2) public <AEO, AEQ extends AEO> Cons<AEQ> append(Cons<AEO> var1, Cons<AEQ> var2) public <BH, AEQ> Cons<AEQ> append(Empty<BH> var1, Cons<AEQ> var2) public <BI, BH> BI append(Empty<BH> var1, BI var2) public <AEJ extends ABQ, ABQ> Cons<AEJ> append(Cons<ABQ> var1, Empty<AEJ> var2) ``` @pl Sieht das richtig aus?
Author
Owner

Was ich nicht ganz verstehe ist wieso List hier nirgendwo auftaucht, das sollte doch der allgemeinste Typ sein...

Was ich nicht ganz verstehe ist wieso `List` hier nirgendwo auftaucht, das sollte doch der allgemeinste Typ sein...
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: JavaTX/JavaCompilerCore#353
No description provided.