Skip to content

Commit fbb6b46

Browse files
committed
suppress: clean after suppress, because scc tycker use the same StmtTycker
1 parent 0982d59 commit fbb6b46

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

Diff for: base/src/main/java/org/aya/tyck/StmtTycker.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public void suppress(@NotNull Decl decl) {
7171
});
7272
}
7373
public @Nullable TyckDef check(@NotNull Decl predecl) {
74-
suppress(predecl);
7574
ExprTycker tycker = null;
7675
if (predecl instanceof TeleDecl decl) {
7776
if (decl.ref().signature == null) tycker = checkHeader(decl);
7877
}
7978

80-
return switch (predecl) {
79+
suppress(predecl);
80+
var core = switch (predecl) {
8181
case FnDecl fnDecl -> {
8282
var fnRef = fnDecl.ref;
8383
assert fnRef.signature != null;
@@ -141,6 +141,8 @@ yield switch (fnDecl.body) {
141141
yield new DataDef(data.ref, data.body.map(kon -> kon.ref.core));
142142
}
143143
};
144+
reporter.clearSuppress();
145+
return core;
144146
}
145147

146148
public ExprTycker checkHeader(@NotNull TeleDecl decl) {
@@ -181,6 +183,7 @@ else fail(BadTypeError.doNotLike(tycker.state, result, signature.result(),
181183
}
182184
}
183185
}
186+
reporter.clearSuppress();
184187
return tycker;
185188
}
186189
private void checkMember(@NotNull ClassMember member, @NotNull ExprTycker tycker) {

Diff for: cli-impl/src/test/java/org/aya/test/fixtures/PatTyckError.java

+5
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ def not (b : Bool) : Bool
123123
| true => Bool::false
124124
| false => Bool::true
125125
126+
@suppress(UnimportedCon, UnreachableClause)
127+
def don't-care (b : Bool) : Bool
128+
| true => Bool::false
129+
| false => Bool::true
130+
126131
inductive RealCase (b : Bool)
127132
| true => real_true
128133
""";

Diff for: cli-impl/src/test/resources/negative/PatTyckError.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,12 @@ In file $FILE:5:2 ->
334334

335335
Warning: The 2nd clause is dominated by the other clauses, hence unreachable
336336

337-
In file $FILE:8:2 ->
337+
In file $FILE:13:2 ->
338338

339-
6
340-
7 │ inductive RealCase (b : Bool)
341-
8 │ | true => real_true
342-
│ ╰──╯
339+
11
340+
12 │ inductive RealCase (b : Bool)
341+
13 │ | true => real_true
342+
│ ╰──╯
343343

344344
Warning: You wrote the following pattern:
345345
true

Diff for: tools/src/main/java/org/aya/util/reporter/SuppressingReporter.java

+2
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ public SuppressingReporter(@NotNull Reporter reporter) {
2121
public void suppress(@NotNull Class<? extends Problem> problem) {
2222
suppressed.add(problem);
2323
}
24+
25+
public void clearSuppress() { suppressed.clear(); }
2426
}

0 commit comments

Comments
 (0)