swift
23f5e015 - [CXX Interoperability] Stop re-importing FuncDecl when FuncDecl is imported before parent record (#59607)

Commit
3 years ago
[CXX Interoperability] Stop re-importing FuncDecl when FuncDecl is imported before parent record (#59607) We saw a test case failing when 2 records contain the same operator. This occurs because when the first operator is called, we import the record associated with that operator but we also import the _function_ for the 2nd record. So if we have 2 records `Foo` and `Bar` and both implement `operator-`, after calling `Foo`'s `operator-` we would have imported 1. `Foo` 2. `Foo.operator-` 3. `Bar.operator-` Then when we call `Bar.operator-` we try importing `Bar` record & then import the operator again. So that ends up with 1. `Foo` 2. `Foo.operator-` 3. `Bar.operator-` 4. `Bar` 5. `Bar.operator-` which causes there to be 2 imports of the same operator (`FuncDecl`) This patch checks to see if the `FuncDecl` was previously imported and returns early if it has been Thanks @egorzhdan and @zoecarver for helping me debug this one :p
Author
Parents
Loading