Skip to content

Commit

Permalink
Ignore all errors in DeriveValueInstanceTypes, errors will be detecte…
Browse files Browse the repository at this point in the history
…d by `TypeValidator`

If just return CompilationProblems from this pass, we will report some errors twice,
because `TypeValidator` alro reports errors from the `TypeDetector`
  • Loading branch information
Mingun committed Oct 5, 2024
1 parent 75e8e57 commit 593b182
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DeriveValueInstanceTypes(specs: ClassSpecs) extends PrecompileStep {
Log.typeProcValue.info(() => s"${instName.name} type undecided: ${tue.getMessage}")
// just ignore, we're not there yet, probably we'll get it on next iteration
case err: ExpressionError =>
throw ErrorInInput(err, vi.path ++ List("value")).toException
// Ignore all errors, the validation will be performed in TypeValidator pass later
}
case Some(_) =>
// already derived, do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ class TypeValidator(specs: ClassSpecs) extends PrecompileStep {

def validateValueInstance(vis: ValueInstanceSpec): Option[CompilationProblem] = {
try {
// detectType performs some additional checks that validate does not (for example,
// applicability of operators to types, like `Not` to numbers).
// TODO: probably implement those checks in validate too?
detector.detectType(vis.value)
detector.validate(vis.value)
None
} catch {
Expand Down

0 comments on commit 593b182

Please sign in to comment.