|
|
@@ -11,6 +11,7 @@
|
|
|
#include <vector>
|
|
|
|
|
|
#include "executable_semantics/ast/function_definition.h"
|
|
|
+#include "executable_semantics/common/error.h"
|
|
|
#include "executable_semantics/common/tracing_flag.h"
|
|
|
#include "executable_semantics/interpreter/interpreter.h"
|
|
|
|
|
|
@@ -19,20 +20,18 @@ namespace Carbon {
|
|
|
void ExpectType(int line_num, const std::string& context, const Value* expected,
|
|
|
const Value* actual) {
|
|
|
if (!TypeEqual(expected, actual)) {
|
|
|
- llvm::errs() << line_num << ": type error in " << context << "\n"
|
|
|
- << "expected: " << *expected << "\n"
|
|
|
- << "actual: " << *actual << "\n";
|
|
|
- exit(-1);
|
|
|
+ FatalUserError() << line_num << ": type error in " << context << "\n"
|
|
|
+ << "expected: " << *expected << "\n"
|
|
|
+ << "actual: " << *actual;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void ExpectPointerType(int line_num, const std::string& context,
|
|
|
const Value* actual) {
|
|
|
if (actual->tag() != ValKind::PointerType) {
|
|
|
- llvm::errs() << line_num << ": type error in " << context << "\n"
|
|
|
- << "expected a pointer type\n"
|
|
|
- << "actual: " << *actual << "\n";
|
|
|
- exit(-1);
|
|
|
+ FatalUserError() << line_num << ": type error in " << context << "\n"
|
|
|
+ << "expected a pointer type\n"
|
|
|
+ << "actual: " << *actual;
|
|
|
}
|
|
|
}
|
|
|
|