diff --git a/src/tink/macro/BuildCache.hx b/src/tink/macro/BuildCache.hx index 3a2f30b..c1878f4 100644 --- a/src/tink/macro/BuildCache.hx +++ b/src/tink/macro/BuildCache.hx @@ -93,6 +93,10 @@ class BuildCache { switch Context.getLocalType() { case TInst(_.toString() == name => true, [v]): type = v; + case TInst(_.toString() == name => true, _): + Context.fatalError('type parameter expected', pos); + case TInst(_.get() => { pos: pos }, _): + Context.fatalError('Expected $name', pos); default: throw 'assert'; } diff --git a/src/tink/macro/Constructor.hx b/src/tink/macro/Constructor.hx index 16bcfeb..465ae2f 100644 --- a/src/tink/macro/Constructor.hx +++ b/src/tink/macro/Constructor.hx @@ -96,7 +96,7 @@ class Constructor { case Success(member): member.addMeta(':isVar'); default: } - addStatement(macro @:pos(pos) (cast this).$name = if (true) $e else this.$name, options.prepend); + addStatement(macro @:pos(pos) (cast this).$name = if (true) $e else this.$name, options.prepend);//TODO: this seems to report type errors here rather than at the declaration position } else addStatement(macro @:pos(pos) this.$name = $e, options.prepend); diff --git a/src/tink/macro/Positions.hx b/src/tink/macro/Positions.hx index 9bb6f4b..d39cd04 100644 --- a/src/tink/macro/Positions.hx +++ b/src/tink/macro/Positions.hx @@ -35,7 +35,7 @@ class Positions { return errorFunc(sanitize(pos), Std.string(error)); static function contextError(pos:Position, error:String):Dynamic - return Context.error(error, pos); + return Context.fatalError(error, pos); static function abortTypeBuild(pos:Position, error:String):Dynamic return throw new AbortBuild(error, pos);