mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-11 03:38:07 +00:00
* fix(#2965): system headers must not resolve to in-repo files C and C++ use two syntactically distinct include forms: #include <x.h> -- angle-bracket: search system include paths only #include "x.h" -- quoted: search relative to the including file first The old suffix-match fallback in resolveCImportTarget had no awareness of this distinction, so a repo containing its own stdio.h would capture every #include <stdio.h> and resolve it to the local file. Fix: - Add isSystem?: boolean to the wildcard variant of ParsedImportSyntax - interpretCImport / interpretCppImport now set isSystem from the @import.system tree-sitter capture (present for angle-bracket form) - resolveImportTarget in both cScopeResolver and cppScopeResolver short-circuits to null when context.parsedImport.isSystem is true, refusing to suffix-match system headers against workspace files - Remove C and C++ from KNOWN_GAPS in the conformance test; add proper test cases with a parsedImport factory that distinguishes angle-bracket (isSystem:true) from quoted (isSystem:false) includes Test: all 36 external-import-conformance cases pass, including the two new c/cpp arms that were previously in KNOWN_GAPS. * fix(#2965): update cpp-imports unit tests for isSystem field Two test assertions were broken by the interpreter change: 1. Local include: the wildcard ParsedImport now always includes isSystem (false for quoted includes). Updated expected object to include isSystem:false. 2. System header: the old test asserted interpretCppImport returned null for system headers. The refactored design moves the null decision to the resolver layer (cppScopeResolver.resolveImportTarget) so the call graph and resolution stay separate concerns. The interpreter now returns { kind:'wildcard', isSystem:true } and the test name/assertion are updated to reflect this. * fix(#2965): resolve C and C++ includes on search paths Angle includes follow each translation unit's include roots, so a local stdio.h no longer captures system headers or another file's -I list. Co-authored-by: Cursor <cursoragent@cursor.com> * Address PR review feedback (#3341) - Accept in-repo include roots whose names start with `..` while still rejecting parent escapes. - Correct the import-target bench comments so CONTEXT_LANGS and newPass match C/C++ header passes. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(c,cpp): read include config per directory for monorepos (#2965) Angle includes now resolve only against declared search roots, so config read only at the repo root left monorepo sub-projects with nothing declared. - compile_commands.json, compile_flags.txt, .ccls, .clangd and c_cpp_properties.json are read in every directory; a file takes the nearest one, and a nearer database's entry beats a shallower one (clangd). - CMake include_directories / target_include_directories are read: directory-scoped and PRIVATE roots reach their subtree, PUBLIC and INTERFACE roots reach every file. ${CMAKE_CURRENT_SOURCE_DIR} and friends expand; unresolvable variables and generator expressions are dropped. - Declared roots win: implicit include/Headers/inc roots apply only when no config speaks for the file, and never to a database-listed file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(c,cpp): give CMake PUBLIC includes only to linked targets (#3341) target_link_libraries now decides who sees PUBLIC and INTERFACE roots, so an unrelated target no longer resolves another package's headers. --------- Co-authored-by: Gergő Magyar <gergomagyar@icloud.com> Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| cpp-adl-seq-coverage.test.ts | ||
| cpp-arity.test.ts | ||
| cpp-captures.test.ts | ||
| cpp-constraint.test.ts | ||
| cpp-file-local-linkage.test.ts | ||
| cpp-imports.test.ts | ||
| cpp-member-lookup-side-channel.test.ts | ||
| cpp-overload-ranking.test.ts | ||
| cpp-qualified-ns-index.test.ts | ||