diff --git a/tests/test_kotlin_grammar.py b/tests/test_kotlin_grammar.py index f840f1af5e..05b72e4e9d 100644 --- a/tests/test_kotlin_grammar.py +++ b/tests/test_kotlin_grammar.py @@ -753,3 +753,26 @@ def test_kotlin_annotation_class_literal(tmp_path): if e["relation"] == "references" and e.get("context") == "attribute"} assert (order, customer) in attrs assert (order, order_line) in attrs + + +def test_kotlin_annotation_fully_qualified_class_literal(tmp_path): + r = _extract(tmp_path, { + "Order.kt": "@Ann(target = com.example.Customer::class)\nclass Order\nclass Customer\n", + }) + order = _find(r, "Order") + customer = _find(r, "Customer") + attrs = {(e["source"], e["target"]) for e in r["edges"] + if e["relation"] == "references" and e.get("context") == "attribute"} + assert (order, customer) in attrs + + +def test_kotlin_annotation_builtin_class_literal_is_filtered(tmp_path): + r = _extract(tmp_path, { + "Order.kt": "@Ann(target = String::class)\nclass Order\n", + }) + order = _find(r, "Order") + attrs = [e for e in r["edges"] if e["source"] == order + and e["relation"] == "references" and e.get("context") == "attribute"] + annotation = _find(r, "Ann") + assert any(e["target"] == annotation for e in attrs) + assert not any(n["label"] == "String" for n in r["nodes"])