Skip to content

Always emit a (possibly empty) list of warnings and move the CaseModeCheck before the TypeCheck

Fredrik Wieczerkowski requested to merge warnings-and-errs into master

This addresses #155 by:

  • Swapping WriterT and ExceptT in the CYT monad transformer to make sure that warnings are always emitted, even when the compilation fails.

    Moving the ExceptT to the outermost (or innermost, depending on the viewpoint) layer of the transformer stack changes the result type from

            errors        warnings
               v             v
    Either [Message] (a, [Message])

    to

             errors       warnings
                v            v
    (Either [Message] a, [Message])

    Notably this is a source-breaking change for any clients consuming the Curry frontend as a library. I believe, however, that emitting warnings even when the compilation fails is a good idea in general and worth the potentially required downstream changes. Internally it is a rather small change anyway since the helper methods around the CYT monads are already well-abstracted.

  • Moving the CaseModeCheck after the SyntaxCheck. This makes sure that types and values are disambiguated correctly, while making sure the warnings are generated before the type check.

I have also updated the unit

Merge request reports

Loading