Preempt the generic case for cast and the

This commit is contained in:
2023-03-03 13:34:22 -07:00
parent f3ccb56f55
commit 2913c2b897

View File

@@ -13,6 +13,7 @@ using kiss.Helpers;
using kiss.Prelude; using kiss.Prelude;
using kiss.Kiss; using kiss.Kiss;
using tink.MacroApi; using tink.MacroApi;
using StringTools;
import tink.syntaxhub.*; import tink.syntaxhub.*;
// Special forms convert Kiss reader expressions into Haxe macro expressions // Special forms convert Kiss reader expressions into Haxe macro expressions
@@ -439,7 +440,7 @@ class SpecialForms {
}; };
if (pkg.length > 0) if (pkg.length > 0)
type = pkg + "." + type; type = pkg + "." + type;
ECheckType(k.convert(args[1]), Helpers.parseComplexType(type, wholeExp, true)).withMacroPosOf(wholeExp); ECheckType(k.convert(args[1]), Helpers.parseComplexType(type, wholeExp, !type.contains("<"))).withMacroPosOf(wholeExp);
}; };
k.doc("try", 1, null, "(try <thing> <catches...>)"); k.doc("try", 1, null, "(try <thing> <catches...>)");
@@ -522,7 +523,7 @@ class SpecialForms {
if (args.length > 1) { if (args.length > 1) {
switch (args[1].def) { switch (args[1].def) {
case Symbol(typePath): case Symbol(typePath):
t = Helpers.parseComplexType(typePath, wholeExp, true); t = Helpers.parseComplexType(typePath, wholeExp, !typePath.contains("<"));
default: default:
throw KissError.fromExp(wholeExp, 'second argument to cast should be a type path symbol'); throw KissError.fromExp(wholeExp, 'second argument to cast should be a type path symbol');
} }