carp-lang / Carp

A statically typed lisp, without a GC, for real-time applications.
Apache License 2.0
5.52k stars 173 forks source link

fix: respect symbol modes on interface concretization #1415

Closed scolsen closed 2 years ago

scolsen commented 2 years ago

When concretizing interfaces (finding the appropriate implementation at a call site) we previously set the lookup mode of all such resolved symbols to CarpLand AFunction. This incorrectly overwrites the lookup mode of Externally registered types, causing them to emit incorrect C when the user specifies an override.

We now preserve whatever lookup mode is assigned to the implementation the concretization resolves the interface to. This not only fixes the external override emission issue, but should be more correct in general.

fixes https://github.com/carp-lang/Carp/issues/1414