Fix haxe3
This commit is contained in:
@@ -209,9 +209,9 @@ class Types {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static public function deduceCommonType(types:Array<Type>):Outcome<Type, Error> {
|
static public function deduceCommonType(types:Array<Type>):Outcome<Type, Error> {
|
||||||
var exprs = types.map(t ->{
|
var exprs = types.map(function(t) {
|
||||||
var ct = t.toComplex();
|
var ct = t.toComplex();
|
||||||
macro (null:$ct);
|
return macro (null:$ct);
|
||||||
});
|
});
|
||||||
|
|
||||||
return switch (macro $a{exprs}).typeof() {
|
return switch (macro $a{exprs}).typeof() {
|
||||||
|
|||||||
@@ -67,10 +67,11 @@ class Types extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testDeduceCommonType() {
|
function testDeduceCommonType() {
|
||||||
assertEquals('StdTypes.Float', tink.macro.Types.deduceCommonType([(macro:Float), (macro:Int)].map(ct -> ct.toType().sure())).sure().toComplex().toString());
|
function ct2t(ct:ComplexType) return ct.toType().sure();
|
||||||
assertEquals('Types.CommonI1', tink.macro.Types.deduceCommonType([(macro:Types.CommonA), (macro:Types.CommonB), (macro:Types.CommonC)].map(ct -> ct.toType().sure())).sure().toComplex().toString());
|
assertEquals('StdTypes.Float', tink.macro.Types.deduceCommonType([(macro:Float), (macro:Int)].map(ct2t)).sure().toComplex().toString());
|
||||||
assertEquals('Types.CommonI2', tink.macro.Types.deduceCommonType([(macro:Types.CommonB), (macro:Types.CommonC)].map(ct -> ct.toType().sure())).sure().toComplex().toString());
|
assertEquals('Types.CommonI1', tink.macro.Types.deduceCommonType([(macro:Types.CommonA), (macro:Types.CommonB), (macro:Types.CommonC)].map(ct2t)).sure().toComplex().toString());
|
||||||
// assertEquals('Types.CommonI3', tink.macro.Types.deduceCommonType([(macro:Types.CommonC)].map(ct -> ct.toType().sure())).sure().toComplex().toString());
|
assertEquals('Types.CommonI2', tink.macro.Types.deduceCommonType([(macro:Types.CommonB), (macro:Types.CommonC)].map(ct2t)).sure().toComplex().toString());
|
||||||
|
// assertEquals('Types.CommonI3', tink.macro.Types.deduceCommonType([(macro:Types.CommonC)].map(ct2t)).sure().toComplex().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|||||||
Reference in New Issue
Block a user