-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Test case for Issue 3281: | ||
// https://github.com/typetools/checker-framework/issues/3281 | ||
|
||
// @skip-test until the bug is fixed | ||
|
||
import org.checkerframework.checker.regex.RegexUtil; | ||
import org.checkerframework.checker.regex.qual.Regex; | ||
|
||
public class Issue3281 { | ||
|
||
@Regex String f = null; | ||
|
||
public boolean b = false; | ||
|
||
void m1(String s) { | ||
if (true) { | ||
// :: error: (argument.type.incompatible) | ||
Pattern.compile(s); | ||
} | ||
} | ||
|
||
void m2(String s) { | ||
RegexUtil.isRegex(s); | ||
if (true) { | ||
// :: error: (argument.type.incompatible) | ||
Pattern.compile(s); | ||
} | ||
} | ||
|
||
void m2f(String s) { | ||
RegexUtil.isRegex(s); | ||
if (true) { | ||
// :: error: (assignment.type.incompatible) | ||
f = s; | ||
} | ||
} | ||
|
||
void m3(String s) { | ||
if (RegexUtil.isRegex(s)) { | ||
Pattern.compile(s); | ||
} | ||
} | ||
|
||
void m4(String s, String s2) { | ||
RegexUtil.isRegex(s); | ||
if (RegexUtil.isRegex(s2)) { | ||
Pattern.compile(s); | ||
} | ||
} | ||
|
||
void m4f(String s, String s2) { | ||
RegexUtil.isRegex(s); | ||
if (RegexUtil.isRegex(s2)) { | ||
// :: error: (assignment.type.incompatible) | ||
f = s; | ||
} | ||
} | ||
|
||
void m5f(String s, String s2) { | ||
RegexUtil.isRegex(s); | ||
if (b) { | ||
// :: error: (assignment.type.incompatible) | ||
f = s; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters