Skip to content

Commit 2a07a02

Browse files
d10cCopilot
andcommitted
Add direct MakeTest inline learning
Expose the learnEdits protocol from direct MakeTest queries without relying on query metadata or @id. Share edit emission with qlref postprocessing while restricting direct reconciliation to safe line-comment syntax and leaving unsupported forms for verification. Add Python and Java fixtures covering custom expected tags, foreign tags, standard tags, and missing query IDs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e860263a-9e7b-4451-8b4a-3b5d119a962c
1 parent 5b1df91 commit 2a07a02

7 files changed

Lines changed: 367 additions & 193 deletions

File tree

‎java/ql/test/library-tests/InlineExpectationsTest/learn-edits/Test.expected‎

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Test {
2+
void target() {} // $ java-direct
3+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java
2+
import utils.test.InlineExpectationsTest
3+
4+
module DirectTest implements TestSig {
5+
string getARelevantTag() { result = "java-direct" }
6+
7+
predicate hasActualResult(Location location, string element, string tag, string value) {
8+
exists(Method method |
9+
method.getName() = "target" and
10+
method.fromSource() and
11+
location = method.getLocation() and
12+
element = method.toString() and
13+
tag = "java-direct" and
14+
value = ""
15+
)
16+
}
17+
}
18+
19+
import MakeTest<DirectTest>

‎python/ql/test/library-tests/InlineExpectationsTest/learn-edits/Test.expected‎

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import python
2+
import utils.test.InlineExpectationsTest
3+
4+
module DirectTest implements TestSig {
5+
string getARelevantTag() { result = "direct" }
6+
7+
string getARelevantExpectedTag() { result = ["direct", "direct[alias]"] }
8+
9+
bindingset[expectedTag, actualTag]
10+
predicate tagMatches(string expectedTag, string actualTag) {
11+
expectedTag = ["direct", "direct[alias]"] and actualTag = "direct"
12+
}
13+
14+
predicate hasActualResult(Location location, string element, string tag, string value) {
15+
exists(Name name |
16+
name.getId() = "target" and
17+
location = name.getLocation() and
18+
element = name.toString() and
19+
tag = "direct" and
20+
value = ""
21+
)
22+
}
23+
}
24+
25+
import MakeTest<DirectTest>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target = 1 # $ direct[alias] foreign

0 commit comments

Comments
 (0)