finos / morphir-elm

Tools to work with the Morphir IR in Elm.
https://package.elm-lang.org/packages/finos/morphir-elm/latest
Apache License 2.0
45 stars 63 forks source link

Type checker does not enforce that generic parameters are generic #1102

Open edwardpeters opened 1 year ago

edwardpeters commented 1 year ago

Describe the bug If you declare a function as generic, but implement it in a way that only works for a single type, no error is given

To Reproduce Compile the following code snippet:

typeErrorTest : t -> t
typeErrorTest x = if x then True else False

This does not throw an error with make or make -f.

Expected behavior I would expect this code to throw an error, as you declared the function to use a generic type t, which cannot be inferred to be a specific type. (This is the behavior using Elm).

Desktop (please complete the following information):