eivindgl/pt-compiler — Issue #20: Type argument N is of type X which is not a subtype of X
Author: eyvindwa
Created: 2011-11-25 08:18:17+00:00
State: open

Her er et lite eksempel, forenklet fra grafbiblioteket, som fremprovoserer feilmeldingen i tittelen:

template GC {
public interface ReadWritePropertyMap {
void set(Key k, Value v);
}
}

template GCI {
inst GC;

public class indirect_cmp<
Vertex,
Distance,
DistanceMap extends ReadWritePropertyMap > {

public indirect_cmp(DistanceMap distance) { }

assumed indirect_cmp(DistanceMap distance);
}
}

template A {

inst GCI;

required type Vertex { }

public class dijkstra_shortest_paths {
public static , Distance >
void dijkstra_shortest_paths(DistanceMap distance, Distance inf) {

indirect_cmp icmp
= new indirect_cmp(distance);
}
}
}

package P {
inst A with Vertex <= java.lang.Integer;
}

Den konkrete feilmeldingen jeg får er

PT: Semantic errors:
JPT: examples/sameGenericParam/Example.java:34:
Semantic Error: type argument 2 is of type DistanceMap which is not a subtype of DistanceMap
JPT: examples/sameGenericParam/Example.java:35:
Semantic Error: type argument 2 is of type DistanceMap which is not a subtype of DistanceMap
Compilation failed: fatal errors.