2022-05-17 10:22:40 +00:00
|
|
|
# Typeinference for Featherweight Java
|
|
|
|
|
|
|
|
## Getting started
|
2021-12-02 02:04:00 +00:00
|
|
|
|
|
|
|
[Try it here](https://janulrich.github.io/FeatherweightTypeInference/)
|
|
|
|
|
2022-05-17 10:22:40 +00:00
|
|
|
## Building
|
|
|
|
|
|
|
|
```sbt fullLinkJS```
|
|
|
|
|
2021-12-02 02:04:00 +00:00
|
|
|
### Input Examples
|
|
|
|
|
|
|
|
```
|
|
|
|
class Identity extends Object{
|
|
|
|
id(a){
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
class Overloading extends Object{
|
|
|
|
m(a, b){return a;}
|
|
|
|
m(a,b){return b;}
|
|
|
|
}
|
|
|
|
|
|
|
|
class TestOverloading extends Object{
|
|
|
|
test(a){
|
2022-07-23 07:36:37 +00:00
|
|
|
return new Overloading().m(this,a);
|
2021-12-02 02:04:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
class List<A extends Object> extends Object{
|
|
|
|
A head;
|
|
|
|
List<A> tail;
|
|
|
|
add( a){
|
|
|
|
return new List(a, this);
|
|
|
|
}
|
|
|
|
get(){
|
|
|
|
return this.head;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class PrincipleType extends Object {
|
|
|
|
function(a){
|
|
|
|
return a.add(this).get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|