From f269d13abf5f3d1b242107f55a560be8fc7a902d Mon Sep 17 00:00:00 2001 From: Juraj Kirchheim Date: Wed, 31 Jan 2018 15:43:52 +0100 Subject: [PATCH] Add workaround for HaxeFoundation/haxe#6830. --- src/tink/macro/Sisyphus.hx | 5 ++++- tests/Types.hx | 4 ++++ tests/VarChar.hx | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/VarChar.hx diff --git a/src/tink/macro/Sisyphus.hx b/src/tink/macro/Sisyphus.hx index 473878b..442d1a1 100644 --- a/src/tink/macro/Sisyphus.hx +++ b/src/tink/macro/Sisyphus.hx @@ -109,7 +109,10 @@ class Sisyphus { pack: baseType.pack, name: name, sub: sub, - params: [ for (t in params) TPType(toComplexType(t)) ], + params: [for (t in params) switch t { + case TInst(_.get().kind => KExpr(e), _): TPExpr(e); + default: TPType(toComplexType(t)); + }], } } } diff --git a/tests/Types.hx b/tests/Types.hx index 680b6ab..f373f6c 100644 --- a/tests/Types.hx +++ b/tests/Types.hx @@ -45,6 +45,10 @@ class Types extends Base { MacroApi.pos().makeBlankType().toString(); } + function testExpr() { + assertEquals('VarChar<255>', (macro : VarChar<255>).toType().sure().toComplex().toString()); + } + function testToComplex() { assertEquals('String', Context.getType('String').toComplex().toString()); assertEquals('tink.CoreApi.Noise', Context.getType('tink.CoreApi.Noise').toComplex().toString()); diff --git a/tests/VarChar.hx b/tests/VarChar.hx new file mode 100644 index 0000000..6484f94 --- /dev/null +++ b/tests/VarChar.hx @@ -0,0 +1 @@ +typedef VarChar<@:const L> = String; \ No newline at end of file