Point out what the goal translation is
This commit is contained in:
parent
56c360104b
commit
fb7b51a971
@ -1,13 +1,49 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Number;
|
||||
import java.lang.Float;
|
||||
|
||||
record Point(Integer x, Integer y) {}
|
||||
record Point(Number x, Number y) {}
|
||||
|
||||
public class OverloadPattern {
|
||||
m(Point(Integer x, Integer y)) {
|
||||
return x + y;
|
||||
}
|
||||
|
||||
m(Point(Float x, Float y)) {
|
||||
return x * y;
|
||||
}
|
||||
|
||||
m(Integer x) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public class OverloadPattern {
|
||||
Integer m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(Point point) {
|
||||
var x = point.x();
|
||||
var y = point.y();
|
||||
return x + y;
|
||||
}
|
||||
|
||||
Float m$Point$_$java$lang$Float$_$java$lang$Float$_$(Point point) {
|
||||
var x = point.x();
|
||||
var y = point.y();
|
||||
return x * y;
|
||||
}
|
||||
|
||||
Object m(Point point) {
|
||||
switch(point) {
|
||||
case Point(Integer x, Integer y) ->
|
||||
m$Point$_$java$lang$Integer$_$java$lang$Integer$_$(point);
|
||||
case Point(Float x, Float y) ->
|
||||
m$Point$_$java$lang$Float$_$java$lang$Float$_$(point);
|
||||
}
|
||||
}
|
||||
|
||||
Integer m(Integer x) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
Loading…
Reference in New Issue
Block a user