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

Multi-level Type aliasing produces "unknown error" in input field of Morphir web #1116

Open emmaodametey opened 9 months ago

emmaodametey commented 9 months ago

Describe the bug Type aliasing a concrete type on multiple levels does not define the type in the input field of morphir web. When a type alias; "CustomA" references a basic type "Int", the basic type is displayed in the input section of Morphir web as the type of that input parameter but when another type alias "Custom B" references Custom A, the type represented in the input section of the Morphir web is "?" and "unknown error" is displayed when any input is typed in.

To Reproduce Steps to reproduce the behavior:

  1. Define the following Elm model:
    
    type alias CustomA =
    Int
    type alias CustomB =
    CustomA
    type alias Foo =
    { works : Int
    , worksToo : CustomA
    , bug : CustomB
    }

funct1 : Foo-> Foo funct1 foo = foo

funct2 : CustomB -> CustomB funct2 customB = customB


3. Navigate to funt1 function in the UI and fill in the input values
4. Check the type annotated for works and worksToo in the Foo record on Morphir Web
5. Notice that it's Int
6. Check the type annotated for bug in the Foo record on Morphir Web
7. Notice that it's "?" and not Int
8. Notice that attempting to input a value into bug field throws "unknown error"
9. funct2 behaves similarly

![image](https://github.com/finos/morphir-elm/assets/128140386/9366b076-a56a-4cc7-b57f-a0ab8fa195ee)

**Expected behavior**
The type for the bug field in record Foo should be represented as Int because the base type is an Int

**Desktop (please complete the following information):**
 - OS: Windows
 - Browser: Chrome
 - Version : 2.86.0