diff --git a/src/tink/macro/BuildCache.hx b/src/tink/macro/BuildCache.hx index 0a8037e..f747eb8 100644 --- a/src/tink/macro/BuildCache.hx +++ b/src/tink/macro/BuildCache.hx @@ -165,7 +165,17 @@ private class Group { return switch entries.get(type) { case null: - make('$name${counter++}'); + var ret = null; + while (ret == null) { + try { + Context.getType('$name$counter'); + } + catch (e:Dynamic) { + ret = make('$name$counter'); + } + counter++; + } + ret; case v: try { Context.getType(v.name); diff --git a/src/tink/macro/Types.hx b/src/tink/macro/Types.hx index 5c68e56..77c3a2e 100644 --- a/src/tink/macro/Types.hx +++ b/src/tink/macro/Types.hx @@ -168,11 +168,11 @@ class Types { sub : null, }); - static function resolveDirectType() + static function resolveDirectType() return switch reduce(Context.getLocalType()) { case TInst(_, [TInst(_.get() => { kind: KExpr(e) }, _)]): - types[e.getInt().sure()](); + types[e.getInt().sure()]();//When using compiler server, this call throws on occasion, in which case modifying this file (to update mtime and invalidate the cache) will solve the problem default: throw 'assert'; }