浏览代码

Changed type balancing so variant->bool has priority over bool->variant.

Mark Sibly 7 年之前
父节点
当前提交
424ac21f5d
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      src/mx2cc/balance.monkey2

+ 13 - 1
src/mx2cc/balance.monkey2

@@ -37,12 +37,24 @@ Function BalancePrimTypes:Type( lhs:PrimType,rhs:PrimType )
 	
 	If Not lhs lhs=rhs Else If Not rhs rhs=lhs
 
+	'variant->bool has priority over bool->variant
+	'
+	If lhs=Type.BoolType And rhs=Type.VariantType Return Type.BoolType
+	
+	If rhs=Type.BoolType And lhs=Type.VariantType Return Type.BoolType
+
+	'whatever->variant
+	'
 	If lhs=Type.VariantType Or rhs=Type.VariantType Return Type.VariantType
 
+	'whatever->string
+	'	
 	If lhs=Type.StringType Or rhs=Type.StringType Return Type.StringType
 	
+	'whatever->bool
+	'
 	If lhs=Type.BoolType Or rhs=Type.BoolType Return Type.BoolType
-	
+
 	Return BalanceNumericTypes( lhs,rhs )
 End