Skip to content

HybridObjects with the same name are not included correctly in C++ #1278

@NotGeorgeMessier

Description

@NotGeorgeMessier

What happened?

repro: #1277

UPDATED desc (using test packages):

  1. add Base HybridObject into react-native-nitro-test-external
  2. nitrogen
  3. pod install
  4. clean build folder !!
  5. build -> fail

Seems like NitroTestExternal tries to find HybridBaseSpec_cxx but find it outside of own package in NitroTest since NitroTest also has its own generated HybridBaseSpec_cxx

Both packages works separately ✅

Image

Reproduceable Code

// This is a simple `HybridObject` with just one value.
export interface Base
  extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
  readonly baseValue: number
}

Relevant log output

In file included from /Users/andrejkologreev/Desktop/Dev/Playground/nitro/nitro/packages/react-native-nitro-test-external/nitrogen/generated/ios/NitroTestExternal-Swift-Cxx-Bridge.cpp:11:
/Users/andrejkologreev/Desktop/Dev/Playground/nitro/nitro/packages/react-native-nitro-test/nitrogen/generated/ios/c++/HybridBaseSpecSwift.hpp:74:35: error: field has incomplete type 'NitroTest::HybridBaseSpec_cxx'
   74 |     NitroTest::HybridBaseSpec_cxx _swiftPart;
      |                                   ^
/Users/andrejkologreev/Desktop/Dev/Playground/nitro/nitro/packages/react-native-nitro-test/nitrogen/generated/ios/c++/HybridBaseSpecSwift.hpp:13:29: note: forward declaration of 'NitroTest::HybridBaseSpec_cxx'
   13 | namespace NitroTest { class HybridBaseSpec_cxx; }

Device

iPhone 17 physical

Nitro Modules Version

0.35.2

Nitrogen Version

0.35.2

Can you reproduce this issue in the Nitro Example app here?

Yes, I can reproduce the same issue in the Example app here

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issue regarding the C++ part of Nitro/NitrogennitrogenIssue is related to the code-generator "Nitrogen"

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions