4 Commits
Author SHA1 Message Date
Nicholas BishopandGeoff Romer 54728e47fe Handle ParameterizedClassType in ExportNameScopeToCpp (#8123)
This is a step towards being able to export methods of parameterized
classes. When exporting such a method, the decl context should be a
`ClassTemplateSpecializationDecl`. Thread the scope's specific ID down
from `MapInstIdToClangDeclOrType` and call `ExportClassSpecificToCpp` to
create this context.

Also add a `context.TODO` to prevent too much code from being exercised
with methods of parameterized classes after getting the parent scope, as
that would lead to various test crashes.

The user-visible effect of this change is that the somewhat mysterious
"TODO: non-class non-namespace name scope" error is replaced with "TODO:
support exporting member functions of parameterized classes".

---------

Co-authored-by: Geoff Romer <gromer@google.com>
2026-11-12 23:12:38 +00:00
Chandler Carruth d0badecd2a Switch tests to use the rendered form of diagnostics (#8070)
Historically, we disabled the rendered form in tests outside of
`toolchain/diagnostics`. The idea was to keep tests shorter and avoid
very long chains of autoupdate before stabilizing due to all the line
numbers and other artifacts in the rendered form.

This PR adds `--diagnostic-line-numbers=[all|first]` and defaults to
`first` in tests. This keeps the rendered form so that we can easily
code review that form and the visual cues it does or doesn't provide.
But it removes all but the first location's line numbers to provide
significantly more stability in tests.

By default, tests get the full unicode line-drawing form of diagnostics
so we can ensure all of the artifacts there make sense with the specific
case being diagnosed, but we do retain some focused ASCII-rendering
tests to ensure that fallback remains usable.

There are some issues here that will be fixed in subsequent PRs.
Notably, we try to keep the frame together in the check lines, and so
force some parts to use the first location. This largely works, but
fails in some edge cases, causing the entire frame to be located
incorrectly. There is a TODO about this that we need to fix, and it only
occurs 6 times across the test suite, so it didn't seem worth
front-loading a fix for here.

Assisted-by: Claude Code
2026-11-05 07:19:59 +00:00
Nicholas Bishop 66f03aecb1 Export class friends to C++ (#8068) 2026-11-03 18:28:21 +00:00
Nicholas Bishop 54f37b35bd Fix Carbon methods always being exported as public to C++ (#8063)
Add access tests for private fields and methods, in both regular classes
and generic.

Modify `BuildCppToCarbonThunkDecl` to properly set the access rather
than always using public.

Also add `static` to a method that isn't used outside export.cpp.
2026-10-30 20:06:21 +00:00