When the compiler fails to build a package because of a duplicate module, the resulting error has no module name set. Our JSON decoding for these errors always expected a module name to be present, so instead of reporting a compilation failure we'd get an "unknown compiler error" and crash.
Here's what the JSON looks like for a duplicate module error:
{
"warnings": [],
"errors": [
{
"position": {
"startLine": 1,
"startColumn": 1,
"endLine": 1,
"endColumn": 18
},
"message": " Module Main has been defined multiple times\n",
"errorCode": "DuplicateModule",
"errorLink": "https://github.com/purescript/documentation/blob/master/errors/DuplicateModule.md",
"filename": "src/Main.purs",
"moduleName": null,
"suggestion": null
}
I've tested out this change, and duplicate module errors now properly report as compilation failures.
When the compiler fails to build a package because of a duplicate module, the resulting error has no module name set. Our JSON decoding for these errors always expected a module name to be present, so instead of reporting a compilation failure we'd get an "unknown compiler error" and crash.
Here's what the JSON looks like for a duplicate module error:
I've tested out this change, and duplicate module errors now properly report as compilation failures.