Otherwise operator with erroneous predicate
Posted: 3 Aug 2019 12:19
Hello Thomas,
please check this code (in build 902). The compiler refuses it (unintentionally?). But it compiles when the indicated line is outcommented:
please check this code (in build 902). The compiler refuses it (unintentionally?). But it compiles when the indicated line is outcommented:
Code: Select all
open core, exception
constants
myException : exception = exception(class_name(), constant_name(), "Error").
class predicates
raise_myException : (integer Value) erroneous [programPoint].
raise_myException : (string Value) erroneous [programPoint]. %try outcommenting this line
clauses
raise_myException_explicit(ProgramPoint, Value) :-
raiseDetailed_explicit(ProgramPoint, myException, [namedValue("Value", string(string::present(Value)))]).
class predicates
tryGetValue : (integer Input) -> integer Output determ.
clauses
tryGetValue(1) = 1.
class predicates
getValue : (integer Input) -> integer Output.
clauses
getValue(Input) = tryGetValue(Input)
otherwise raise_myException(Input). %throws error c502: The term does not produce a value
clauses
run() :-
stdIO::write(getValue(1)).