struct Foo {} struct Bar {} type SumType = Foo | Bar fn (f Foo) pstr() { } fn (b Bar) pstr() { } fn main() { a := SumType(Foo{}) match a { Foo, Bar { a.pstr() } } }