Janiczek/elm-syntax-type-inference/2.0.1

Elm.TypeInference.ProjectError

Errors reported while building a Project with Elm.TypeInference.init or updating it with Elm.TypeInference.addFile.

Errors from type inference itself live in Elm.TypeInference.InferError.

= NeedPackageSources (Dict PackageName (List String))
| MissingModuleName
| DuplicateModule ModuleName
| ImpossibleDocsType
{ location : Location
, type_ : Type
}
| ImpossibleType
{ location : Location
, typeAnnotation : TypeAnnotation
}
| AmbiguousModuleOwner
{ location : Location
, moduleName : String
, possiblePackages : List PackageName
}
| TypeNotFound
{ location : Location
, qualifier : ModuleName
, typeName : VarName
}
| WrongTypeArity
{ location : Location
, moduleName : ModuleName
, typeName : VarName
, expected : Int
, actual : Int
}
| RecursiveAlias
{ location : Location
, aliases :
List
{ moduleName : ModuleName
, name : VarName
}
}

Types of errors:

  • NeedPackageSources: Raised by Elm.TypeInference.init when extra dependency sources are needed to analyze whether a docs.json-mentioned internal type is a record or a custom type. Provide these files in sourcesToResolveAmbiguity in the next Elm.TypeInference.init call.

  • MissingModuleName: Raised when a File has an empty module name.

  • DuplicateModule: Raised by Elm.TypeInference.init when two of the projectFiles declare the same module.

  • ImpossibleDocsType: for hand-crafted docs.json with nonsensical data, like a 4-tuple. Real docs.json files emitted by the Elm compiler should never produce these.

  • ImpossibleType: Similar but for hand-crafted elm-syntax Files given in sourcesToResolveAmbiguity.

  • AmbiguousModuleOwner: Raised when a type in a dependency's docs.json or sources refers to a module (moduleName) exposed by more than one package visible to that dependency.

  • TypeNotFound, WrongTypeArity, RecursiveAlias: Raised when a type alias in sourcesToResolveAmbiguity mentions a type that can't be found (eg. because the docs.json of the package defining it wasn't provided), applies a type to the wrong number of arguments, or refers to itself. The Elm compiler rejects all of these when publishing a package, so they only happen with hand-written sourcesToResolveAmbiguity or docs.json files, or with incomplete dependency information.

type alias Location =
{ package : PackageName
, moduleName : ModuleName
, declarationName : VarName
}

Where in a dependency an error was found.

Render an error for diagnostic output.