Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CompilerError decoding in 0.13.x series of purs #635

Merged
merged 4 commits into from
Jul 25, 2023

Conversation

colinwahl
Copy link
Collaborator

While working on #255, @thomashoneyman noticed some log lines reporting unknown compiler errors, like

[STDOUT]
Compiling Data.NaturalTransformation
Compiling Data.Boolean
Compiling Data.Show
Compiling Control.Semigroupoid
Compiling Control.Category
Compiling Data.Unit
Compiling Data.Void
Compiling Data.Semiring
Compiling Data.HeytingAlgebra
Compiling Data.Semigroup
Compiling Data.Eq
Compiling Data.Ring
Compiling Data.BooleanAlgebra
Compiling Data.Ordering
Compiling Data.CommutativeRing
Compiling Data.EuclideanRing
Compiling Data.Ord.Unsafe
Compiling Data.Ord
Compiling Data.DivisionRing
Compiling Data.Field
Compiling Data.Bounded
Compiling Data.Function
Compiling Data.Functor
Compiling Control.Apply
Compiling Control.Applicative
Compiling Control.Bind
Compiling Control.Monad
Compiling Prelude
Compiling Debug.Trace
[STDERR]
{"warnings":[],"errors":[{"position":{"startLine":8,"startColumn":1,"endLine":8,"endColumn":58},"message":"  Unknown type class Warn\n","errorCode":"UnknownName","errorLink":"https://github.com/purescript/documentation/blob/master/errors/UnknownName.md","filename":"/run/user/1000/tmp-714974-ghvoRncaz00A/.registry/debug-3.0.0/src/Debug/Trace.purs","moduleName":"Debug.Trace","suggestion":null,"allSpans":[{"start":[8,1],"name":"/run/user/1000/tmp-714974-ghvoRncaz00A/.registry/debug-3.0.0/src/Debug/Trace.purs","end":[8,58]}]}]}
[DECODE ERROR]
An error occurred while decoding a JSON value:
  Expected value of type 'JSON: Unexpected token C in JSON at position 0'.

It turns out that starting in 0.14.0, compiler errors were switched to being reported to stdout, whereas they used to be in stderr: https://github.com/purescript/purescript/releases/tag/v0.14.0

This PR changes CompilerArgs to take a Version, so we can check that we can get proper Version Ord and check compiler versions before deciding where to try to parse the compiler errors from, and propagates the changes needed to make that typecheck. It also adds tests to catch this case.

@thomashoneyman
Copy link
Member

That explains it! 😂

@colinwahl colinwahl merged commit a6132b8 into master Jul 25, 2023
15 checks passed
@colinwahl colinwahl deleted the colin/old-compiler-errors-json branch July 25, 2023 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants