degory / ghul

compiler for the ghūl programming language
https://ghul.dev
GNU Affero General Public License v3.0
4 stars 0 forks source link

Expression bodied generic functions and methods wrongly attempt to infer return type #1067

Closed degory closed 9 months ago

degory commented 9 months ago

An explicit return type is mandatory for expression bodied functions, but if the function is generic the compiler still attempts to infer the return type from the type of the body.

test[T](t: T) -> List[T] => [t, t, t]

test should have return type List[T] as explicitly specified, but instead it has return type T[], inferred from the type of its expression body.