mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 10:08:29 +00:00
When a Carbon class from another library was used from C++, its fields were never exported, so C++ member access failed with 'no member named'. The class scope of an imported class holds import references rather than `FieldDecl`s, so `LookupClassFieldByStructField` didn't find them. Resolve scope entries to their constant `FieldDecl`, load the import references before exporting fields, and consistently key exported fields by the `FieldDecl`. Unfortunately `SemIR::LookupClassFieldByStructField` can't call `LoadImportRef` because `SemIR::LookupClassFieldByStructField` is in `SemIR` and `LoadImportRef` needs a `Check::Context` (and `check` depends on `sem_ir`, not the other way around, so `sem_ir` can't use check). So instead, make a `Check::LookupClassFieldByStructField` that wraps the `SemIR` version, and does the `LoadImportRef` Assisted-By: Claude --------- Co-authored-by: Christopher Di Bella <cjdb.ns@gmail.com>