Revert "Fix some repl tests"

This reverts commit 0c2cb84b79.
This commit is contained in:
Richard Feldman 2025-11-02 21:40:59 -05:00
parent f33e8fdbac
commit dae4065f3f
No known key found for this signature in database
3 changed files with 12 additions and 9 deletions

View file

@ -239,12 +239,15 @@ pub const Repl = struct {
return try std.fmt.allocPrint(self.allocator, "assigned `{s}`", .{info.var_name});
},
.type_annotation => |info| {
// Store the type annotation for future use
// For type annotations:
// 1. Store them as definitions for future use
try self.addOrReplaceDefinition(info.source, info.var_name);
// Type annotations alone cannot be evaluated - they create e_anno_only which crashes when used
// Return a message indicating the annotation was stored
return try std.fmt.allocPrint(self.allocator, "Crash: runtime error", .{});
// 2. Evaluate the full source (including all definitions + this annotation)
// This will create an e_anno_only which will crash when evaluated
const full_source = try self.buildFullSource(input);
defer self.allocator.free(full_source);
return try self.evaluateSource(full_source);
},
.import => {
// Imports are not supported in this implementation

View file

@ -402,10 +402,10 @@ test "Repl - standalone annotation should crash, then call should fail - REGRESS
const result2 = try repl.step("foo(\"test\")");
defer std.testing.allocator.free(result2);
// Should return a canonicalization error since foo only has a type annotation, no definition
if (std.mem.indexOf(u8, result2, "Canonicalize expr error") == null) {
std.debug.print("\nexpected Canonicalize expr error, got: {s}\n", .{result2});
// Should return "Evaluation error: error.TypeMismatch"
if (std.mem.indexOf(u8, result2, "TypeMismatch") == null) {
std.debug.print("\nexpected TypeMismatch, got: {s}\n", .{result2});
return error.TestUnexpectedResult;
}
try testing.expect(std.mem.indexOf(u8, result2, "expression returned null for apply") != null);
try testing.expect(std.mem.indexOf(u8, result2, "Evaluation error") != null);
}

View file

@ -11,6 +11,6 @@ type=repl
# OUTPUT
Crash: runtime error
---
Canonicalize expr error: expression returned null for apply
Evaluation error: error.TypeMismatch
# PROBLEMS
NIL