Skip to content

Commit

Permalink
fixed mayMatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Feb 8, 2024
1 parent 401c332 commit 7a13680
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/org/rascalmpl/interpreter/matching/NegativePattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void initMatch(Result<IValue> subject){

@Override
public boolean mayMatch(Type subjectType, Environment env){
return pat.mayMatch(subjectType, env);
return subjectType.isSubtypeOf(tf.numberType()) && pat.mayMatch(subjectType, env);
}

@Override
Expand All @@ -56,7 +56,7 @@ public boolean hasNext() {

@Override
public boolean next() {
if(pat.next()) {
if (pat.next()) {
if (subject.getDynamicType().isNumber()) {
return ((INumber) subject.getValue()).lessEqual(IRascalValueFactory.getInstance().integer(0)).getValue();

Check warning on line 61 in src/org/rascalmpl/interpreter/matching/NegativePattern.java

View check run for this annotation

Codecov / codecov/patch

src/org/rascalmpl/interpreter/matching/NegativePattern.java#L61

Added line #L61 was not covered by tests
}
Expand Down

0 comments on commit 7a13680

Please sign in to comment.