Skip to content

Commit

Permalink
Simplify comparability check
Browse files Browse the repository at this point in the history
  • Loading branch information
Anand Thakker committed Dec 11, 2017
1 parent 980ccee commit e81519b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/style-spec/expression/definitions/equals.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const {
ValueType,
BooleanType,
} = require('../types');
const {toString, checkSubtype} = require('../types');
const {toString} = require('../types');

import type { Expression } from '../expression';
import type EvaluationContext from '../evaluation_context';
Expand Down Expand Up @@ -56,7 +56,7 @@ class Equals implements Expression {
return context.error(`Expected at least one argument to be a string, number, boolean, or null, but found (${toString(lhs.type)}, ${toString(rhs.type)}) instead.`);
}

if (checkSubtype(lhs.type, rhs.type) && checkSubtype(rhs.type, lhs.type)) {
if (lhs.type.kind !== rhs.type.kind && lhs.type.kind !== 'value' && rhs.type.kind !== 'value') {
return context.error(`Cannot compare ${toString(lhs.type)} and ${toString(rhs.type)}.`);
}

Expand Down

0 comments on commit e81519b

Please sign in to comment.