diff options
-rw-r--r-- | CiResolver.cs | 8 | ||||
-rw-r--r-- | Makefile | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/CiResolver.cs b/CiResolver.cs index 8a2cd0e..df9da3c 100644 --- a/CiResolver.cs +++ b/CiResolver.cs @@ -579,8 +579,12 @@ public class CiResolver : CiVisitor if (leftRange.Max < rightRange.Min || leftRange.Min > rightRange.Max) return expr.ToLiteral(expr.Op == CiToken.NotEqual);; } - else if (left.Type == right.Type && left is CiLiteral leftLiteral && right is CiLiteral rightLiteral) - return expr.ToLiteral((expr.Op == CiToken.NotEqual) ^ object.Equals(leftLiteral.Value, rightLiteral.Value)); + else if (left.Type == right.Type) { + if (left is CiLiteral leftLiteral && right is CiLiteral rightLiteral) + return expr.ToLiteral((expr.Op == CiToken.NotEqual) ^ object.Equals(leftLiteral.Value, rightLiteral.Value)); + if (left.IsConstEnum && right.IsConstEnum) + return expr.ToLiteral((expr.Op == CiToken.NotEqual) ^ (left.IntValue == right.IntValue)); + } if (!left.Type.IsAssignableFrom(right.Type) && !right.Type.IsAssignableFrom(left.Type)) throw StatementException(expr, "Cannot compare {0} with {1}", left.Type, right.Type); TakePtr(left); @@ -1,6 +1,6 @@ prefix := /usr/local srcdir := $(dir $(lastword $(MAKEFILE_LIST))) -CFLAGS = -Wall -Wno-tautological-compare -Werror +CFLAGS = -Wall -Werror SWIFTC = swiftc ifeq ($(OS),Windows_NT) CSC = "C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/Roslyn/csc.exe" -nologo |