Skip to content

Commit c7b1bb5

Browse files
cknittclaude
andcommitted
Regenerate the callable-instance test for the typeof dispatch
Why: The test added to the bottom of the stack is compiled by this pull request's dispatch, which checks the function arm against the classes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMkrYaktctdKc4M41WF36t Signed-off-by: Christoph Knittel <ck@cca.io>
1 parent 462be18 commit c7b1bb5

1 file changed

Lines changed: 57 additions & 41 deletions

File tree

‎tests/tests/src/untagged_runtime_annotations_test.mjs‎

Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ function handlerKind(handler) {
8686
}
8787
}
8888

89+
function wideHandlerKind(handler) {
90+
if (typeof handler === "string") {
91+
return "name";
92+
} else if (typeof handler === "function" && !(handler instanceof UntaggedAnimal) && !(handler instanceof UntaggedCallable)) {
93+
return "function";
94+
} else {
95+
return "other";
96+
}
97+
}
98+
8999
function objectOrNameKind(value) {
90100
if (typeof value === "string") {
91101
return value;
@@ -184,87 +194,92 @@ function sharedKind(value) {
184194

185195
Mocha.describe("Untagged_runtime_annotations_test", () => {
186196
Mocha.test("a subclass case is not taken for its superclass", () => {
187-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 242, characters 7-14", "animal", describePet(new UntaggedAnimal()));
188-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 243, characters 7-14", "dog", describePet(new UntaggedDog()));
189-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 244, characters 7-14", "rex", "rex");
197+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 259, characters 7-14", "animal", describePet(new UntaggedAnimal()));
198+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 260, characters 7-14", "dog", describePet(new UntaggedDog()));
199+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 261, characters 7-14", "rex", "rex");
190200
});
191201
Mocha.test("a superclass case alone excludes the subclass", () => {
192-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 248, characters 7-14", "animal", onlyAnimal(new UntaggedAnimal()));
193-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 249, characters 7-14", "other", onlyAnimal(new UntaggedDog()));
202+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 265, characters 7-14", "animal", onlyAnimal(new UntaggedAnimal()));
203+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 266, characters 7-14", "other", onlyAnimal(new UntaggedDog()));
194204
});
195205
Mocha.test("declaration order does not matter", () => {
196-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 253, characters 7-14", "dog", describeReversed(new UntaggedDog()));
197-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 254, characters 7-14", "animal", describeReversed(new UntaggedAnimal()));
206+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 270, characters 7-14", "dog", describeReversed(new UntaggedDog()));
207+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 271, characters 7-14", "animal", describeReversed(new UntaggedAnimal()));
198208
});
199209
Mocha.test("a subclass upcasts to its superclass", () => {
200210
let animal = new UntaggedDog();
201-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 259, characters 7-14", "dog", describePet(animal));
211+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 276, characters 7-14", "dog", describePet(animal));
202212
});
203213
Mocha.test("classes reached through a module alias", () => {
204-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 263, characters 7-14", "animal", describeAliased(new UntaggedAnimal()));
205-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 264, characters 7-14", "dog", describeAliased(new UntaggedDog()));
214+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 280, characters 7-14", "animal", describeAliased(new UntaggedAnimal()));
215+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 281, characters 7-14", "dog", describeAliased(new UntaggedDog()));
206216
});
207217
Mocha.test("typeOf symbol", () => {
208-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 268, characters 7-14", "symbol", keyKind(Symbol.for("key")));
209-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 269, characters 7-14", "text", "text");
218+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 285, characters 7-14", "symbol", keyKind(Symbol.for("key")));
219+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 286, characters 7-14", "text", "text");
210220
});
211221
Mocha.test("typeOf string", () => {
212-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 273, characters 7-14", "id", "id");
213-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 274, characters 7-14", "index", "index");
222+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 290, characters 7-14", "id", "id");
223+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 291, characters 7-14", "index", "index");
214224
});
215225
Mocha.test("a class at a dotted path", () => {
216-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 278, characters 7-14", "locale", localeKind(new Intl.Locale("en")));
217-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 279, characters 7-14", "de", "de");
226+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 295, characters 7-14", "locale", localeKind(new Intl.Locale("en")));
227+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 296, characters 7-14", "de", "de");
218228
});
219229
Mocha.test("an annotated type is not wrapped in an option", () => {
220230
let animal = new UntaggedAnimal();
221-
Test_utils.ok("File \"untagged_runtime_annotations_test.res\", line 284, characters 7-14", animal === animal);
222-
Test_utils.ok("File \"untagged_runtime_annotations_test.res\", line 285, characters 7-14", animal === animal);
231+
Test_utils.ok("File \"untagged_runtime_annotations_test.res\", line 301, characters 7-14", animal === animal);
232+
Test_utils.ok("File \"untagged_runtime_annotations_test.res\", line 302, characters 7-14", animal === animal);
223233
});
224234
Mocha.test("a phantom type hierarchy", () => {
225-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 289, characters 7-14", "animal", describePhantom(new UntaggedAnimal()));
226-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 290, characters 7-14", "dog", describePhantom(new UntaggedDog()));
235+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 306, characters 7-14", "animal", describePhantom(new UntaggedAnimal()));
236+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 307, characters 7-14", "dog", describePhantom(new UntaggedDog()));
227237
});
228238
Mocha.test("a function case excludes class instances", () => {
229-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 294, characters 7-14", "callable", handlerKind(new UntaggedCallable()));
230-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 295, characters 7-14", "function", handlerKind(x => x));
239+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 311, characters 7-14", "callable", handlerKind(new UntaggedCallable()));
240+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 312, characters 7-14", "function", handlerKind(x => x));
241+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 313, characters 7-14", "other", wideHandlerKind(new UntaggedCallable()));
242+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 314, characters 7-14", "other", wideHandlerKind(new UntaggedAnimal()));
243+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 315, characters 7-14", "function", wideHandlerKind(x => x));
244+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 316, characters 7-14", "name", "name");
245+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 317, characters 7-14", "other", "other");
231246
});
232247
Mocha.test("a class declared over an object type", () => {
233-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 299, characters 7-14", "dog", objectOrNameKind(new UntaggedDog()));
234-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 300, characters 7-14", "rex", "rex");
248+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 321, characters 7-14", "dog", objectOrNameKind(new UntaggedDog()));
249+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 322, characters 7-14", "rex", "rex");
235250
});
236251
Mocha.test("annotations restating a structural kind", () => {
237-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 304, characters 7-14", "2", restatedKind(id(x => x + 1 | 0)));
238-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 305, characters 7-14", "3", restatedKind(id({
252+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 326, characters 7-14", "2", restatedKind(id(x => x + 1 | 0)));
253+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 327, characters 7-14", "3", restatedKind(id({
239254
px: 3
240255
})));
241-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 306, characters 7-14", "a", restatedKind(id("a")));
242-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 307, characters 7-14", "callback", restatedAbstractKind(id(callback)));
243-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 308, characters 7-14", "point", restatedAbstractKind(id(point)));
244-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 309, characters 7-14", "4", privateOrNameKind(id({
256+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 328, characters 7-14", "a", restatedKind(id("a")));
257+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 329, characters 7-14", "callback", restatedAbstractKind(id(callback)));
258+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 330, characters 7-14", "point", restatedAbstractKind(id(point)));
259+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 331, characters 7-14", "4", privateOrNameKind(id({
245260
px: 4
246261
})));
247-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 310, characters 7-14", "a", privateOrNameKind(id("a")));
248-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 311, characters 7-14", "5", jsOrNameKind(id({
262+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 332, characters 7-14", "a", privateOrNameKind(id("a")));
263+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 333, characters 7-14", "5", jsOrNameKind(id({
249264
pz: 5
250265
})));
251-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 312, characters 7-14", "b", jsOrNameKind(id("b")));
266+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 334, characters 7-14", "b", jsOrNameKind(id("b")));
252267
});
253268
Mocha.test("primitive cases are tested before class checks", () => {
254-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 316, characters 7-14", "a", missingKind(id("a")));
255-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 317, characters 7-14", "count", missingKind(id(1)));
269+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 338, characters 7-14", "a", missingKind(id("a")));
270+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 339, characters 7-14", "count", missingKind(id(1)));
256271
});
257272
Mocha.test("a primitive without an arm skips class checks", () => {
258-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 321, characters 7-14", "a", missingOrDefault(id("a")));
259-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 322, characters 7-14", "other", missingOrDefault(id(1)));
273+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 343, characters 7-14", "a", missingOrDefault(id("a")));
274+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 344, characters 7-14", "other", missingOrDefault(id(1)));
260275
});
261276
Mocha.test("a default shared by a primitive and an object case", () => {
262-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 326, characters 7-14", "date!", sharedKind(id(new Date())));
263-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 327, characters 7-14", "other!", sharedKind(id({
277+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 348, characters 7-14", "date!", sharedKind(id(new Date())));
278+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 349, characters 7-14", "other!", sharedKind(id({
264279
x: 1
265280
})));
266-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 328, characters 7-14", "text!", sharedKind(id("a")));
267-
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 329, characters 7-14", "other!", sharedKind(id(1)));
281+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 350, characters 7-14", "text!", sharedKind(id("a")));
282+
Test_utils.eq("File \"untagged_runtime_annotations_test.res\", line 351, characters 7-14", "other!", sharedKind(id(1)));
268283
});
269284
});
270285

@@ -282,6 +297,7 @@ export {
282297
localeKind,
283298
describePhantom,
284299
handlerKind,
300+
wideHandlerKind,
285301
objectOrNameKind,
286302
Restated,
287303
restatedKind,

0 commit comments

Comments
 (0)