SkSL: Variable references are never "isConstant"

isConstant really means "has a known value at compile time", but for
variables declared with "const", the two meanings had been conflated.
There were several ways for this to produce surprising error messages.
The included unit test crashed before removing the override, and now
passes.

Change-Id: I49b926e51c421db93240cbbf42231de0444358d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299860
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/ir/SkSLVariableReference.h b/src/sksl/ir/SkSLVariableReference.h
index c675144..2d0fade 100644
--- a/src/sksl/ir/SkSLVariableReference.h
+++ b/src/sksl/ir/SkSLVariableReference.h
@@ -54,10 +54,6 @@
         }
     }
 
-    bool isConstant() const override {
-        return 0 != (fVariable.fModifiers.fFlags & Modifiers::kConst_Flag);
-    }
-
     bool isConstantOrUniform() const override {
         return (fVariable.fModifiers.fFlags & Modifiers::kUniform_Flag) != 0;
     }
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp
index 73e364a..c0af2e6 100644
--- a/tests/SkSLErrorTest.cpp
+++ b/tests/SkSLErrorTest.cpp
@@ -37,6 +37,15 @@
     REPORTER_ASSERT(r, program);
 }
 
+DEF_TEST(SkSLConstVariableComparison, r) {
+    test_success(r,
+                 "void main() {"
+                 "  const float4 a = float4(0);"
+                 "  const float4 b = float4(1);"
+                 "  if (a == b) { discard; }"
+                 "}");
+}
+
 DEF_TEST(SkSLOpenArray, r) {
     test_failure(r,
                  "void main(inout float4 color) { color.r[ = ( color.g ); }",