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
46 stars 65 forks source link

Fix elm generator #1175

Closed reebayroo closed 2 months ago

reebayroo commented 3 months ago

Terms

THIS SOFTWARE IS CONTRIBUTED SUBJECT TO THE TERMS OF THE TERMS OF THE CCLA DATED 2017-11-07 WITH FINOS/LINUX FOUNDATION (FORMERLY THE SYMPHONY SOFTWARE FOUNDATION CCLA).

THIS SOFTWARE IS LICENSED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE MAY BE REDISTRIBUTED TO OTHERS ONLY BY EFFECTIVELY USING THIS OR ANOTHER EQUIVALENT DISCLAIMER IN ADDITION TO ANY OTHER REQUIRED LICENSE TERMS.

linux-foundation-easycla[bot] commented 3 months ago

CLA Missing ID CLA Not Signed

reebayroo commented 3 months ago
Detected problems in 1 module.
-- TYPE MISMATCH --------------------------------- src/Morphir/Elm/Generator.elm

Something is off with the body of the `generatorsResult` definition:

107|>                                fqnByTpeSpecsResult
108|>                                    |> Result.andThen
109|>                                        (\fqnByTpeSpecs ->
110|>                                            fqnByTpeSpecs
111|>                                                |> List.map
112|>                                                    (\( fqn, tpeSpec ) ->
113|>                                                        case tpeSpec of
114|>                                                            Type.TypeAliasSpecification args tpe ->
115|>                                                                ValueGenerator.fromType ir tpe
116|>                                                                    |> Result.map (Tuple.pair tpe)
117|>                                                                    |> Result.map (Tuple.pair fqn)
118|>
119|>                                                            Type.OpaqueTypeSpecification lists ->
120|>                                                                Debug.todo "Implement this"
121|>
122|>                                                            Type.CustomTypeSpecification lists constructors ->
123|>                                                                Debug.todo "Implement this"
124|>
125|>                                                            Type.DerivedTypeSpecification lists derivedTypeSpecificationDetails ->
126|>                                                                Debug.todo "Implement this"
127|>                                                    )
128|>                                                |> ResultList.keepFirstError
129|>                                                |> Result.map Dict.fromList
130|>                                        )

The body is:

    Result
        ValueGenerator.Error
        (
        Dict.Dict
   Compiling ...         ( Morphir.IR.Path.Path, Morphir.IR.Path.Path, Morphir.IR.Name.Name )
            ( Type (), Morphir.Generator.API.Generator RawValue )
        )

But the type annotation on `generatorsResult` says it should be:

    Result String (Dict.Dict FQName ( Type (), Generator.Generator RawValue ))

Success!     

    Morphir.Elm.CLI ───> Morphir.Elm.CLI.js