Open cocreature opened 2 years ago
The extra errors (the ones with location 1:1-1:1) come from the records preprocessor (DA.Daml.Preprocessor.Records
), which adds the following instance
instance HasField "f" T MyBrokenType where
-- ^^^^^^^^^^^^
getField = getFieldPrim @"f" @T @MyBrokenType
-- ^^^^^^^^^^^^
setField = setFieldPrim @"f" @T @MyBrokenType
-- ^^^^^^^^^^^^
I don't really know how to get rid of these from the root, since at the preprocessor we have no way of knowing if MyBrokenType
is a type in scope.
At first I thought we could extend the SrcLoc
type with another constructor for compiler- or preprocessor-generated code, which could then be filtered out when reporting errors, but I'm uncomfortable with the idea that a program might fail with just that sort of error - though perhaps in that case we could just show all the errors.
A different approach would be to use the original locations in the generated instance and nubOrd
the diagnostics before showing them.
This produces 4 errors. 3/4 have no location which in vscode confusingly pops up as a module-level error