mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-13 20:53:09 +00:00
FunctionType: substitute angepasst
This commit is contained in:
parent
2adc72cf74
commit
aafb8ead44
@ -41,23 +41,7 @@ public class FunctionType extends Type {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public FunctionType substitute(TypeVariable a, Type b) {
|
public FunctionType substitute(TypeVariable a, Type b) {
|
||||||
boolean first = false;
|
return new FunctionType(parameter.substitute(a, b), output.substitute(a, b));
|
||||||
boolean second = false;
|
|
||||||
if (this.parameter.contains(a)) {
|
|
||||||
first = true;
|
|
||||||
}
|
|
||||||
if (this.output.contains(a)) {
|
|
||||||
second = true;
|
|
||||||
}
|
|
||||||
if (first && second) {
|
|
||||||
return new FunctionType(parameter.substitute(a, b), output.substitute(a, b));
|
|
||||||
} else if (first) {
|
|
||||||
return new FunctionType(parameter.substitute(a, b), output);
|
|
||||||
} else if (second) {
|
|
||||||
return new FunctionType(parameter, output.substitute(a, b));
|
|
||||||
} else {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user