sealed interface List<T> permits Cons, Empty {}
record Cons<T>(T a , List<T> l ) implements List <T> {}
record Empty<T>() implements List <T> {}

public class Bug380 {
    public <T> List<T> append(l1, List<T> l2) {
        return switch ( l1 ) {
            case Cons(e, rest) -> new Cons<>(e, append(rest, l2)); //::Typ TPH A
            case Empty() -> l2;//::TPH B
        };
    }
}
