feat(query): structurally verify supertype queries

This commit is contained in:
Amaan Qureshi 2025-01-12 02:38:32 -05:00
parent ac8bb1b777
commit 5de314833f
2 changed files with 80 additions and 5 deletions

View file

@ -519,6 +519,51 @@ fn test_query_errors_on_impossible_patterns() {
.join("\n")
})
);
assert_eq!(
Query::new(&js_lang, "(identifier/identifier)").unwrap_err(),
QueryError {
row: 0,
offset: 0,
column: 0,
kind: QueryErrorKind::Structure,
message: [
"(identifier/identifier)", //
"^"
]
.join("\n")
}
);
if js_lang.version() >= 15 {
assert_eq!(
Query::new(&js_lang, "(statement/identifier)").unwrap_err(),
QueryError {
row: 0,
offset: 0,
column: 0,
kind: QueryErrorKind::Structure,
message: [
"(statement/identifier)", //
"^"
]
.join("\n")
}
);
assert_eq!(
Query::new(&js_lang, "(statement/pattern)").unwrap_err(),
QueryError {
row: 0,
offset: 0,
column: 0,
kind: QueryErrorKind::Structure,
message: [
"(statement/pattern)", //
"^"
]
.join("\n")
}
);
}
});
}