Commit 31381a3
committed
[cxx-interop] Fix assertion failure when looking up C++ operators
Previously when looking up a C++ operator (e.g. `==`), `ClangImporter::Implementation::lookupValue` returned a Swift function with a generated name (e.g. `func __operatorEqualEqual`), while the caller expected the result to be a Swift operator (e.g. `func ==`).
This change makes sure that we're returning a synthesized Swift operator when looking for a C++ operator.
This fixes an assertion failure in the typechecker:
```
swift-frontend: /home/build-user/swift/lib/Sema/ConstraintSystem.cpp:1454: std::pair<Type, Type> swift::constraints::ConstraintSystem::getTypeOfReference(swift::ValueDecl *, swift::FunctionRefKind, swift::constraints::ConstraintLocatorBuilder, swift::DeclContext *): Assertion `func->isOperator() && "Lookup should only find operators"' failed.
```1 parent 5ed21c6 commit 31381a3
File tree
2 files changed
+42
-21
lines changed- lib/ClangImporter
- test/Interop/Cxx/operators
2 files changed
+42
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4132 | 4132 | | |
4133 | 4133 | | |
4134 | 4134 | | |
4135 | | - | |
4136 | | - | |
4137 | | - | |
4138 | | - | |
4139 | | - | |
4140 | | - | |
4141 | | - | |
4142 | | - | |
4143 | | - | |
4144 | | - | |
4145 | | - | |
4146 | | - | |
4147 | | - | |
4148 | | - | |
4149 | | - | |
4150 | | - | |
| 4135 | + | |
| 4136 | + | |
| 4137 | + | |
| 4138 | + | |
| 4139 | + | |
| 4140 | + | |
4151 | 4141 | | |
4152 | 4142 | | |
4153 | | - | |
4154 | | - | |
4155 | | - | |
| 4143 | + | |
4156 | 4144 | | |
4157 | 4145 | | |
4158 | 4146 | | |
4159 | 4147 | | |
4160 | | - | |
| 4148 | + | |
4161 | 4149 | | |
4162 | 4150 | | |
4163 | | - | |
| 4151 | + | |
| 4152 | + | |
| 4153 | + | |
| 4154 | + | |
| 4155 | + | |
| 4156 | + | |
| 4157 | + | |
| 4158 | + | |
| 4159 | + | |
| 4160 | + | |
| 4161 | + | |
| 4162 | + | |
| 4163 | + | |
| 4164 | + | |
| 4165 | + | |
| 4166 | + | |
| 4167 | + | |
| 4168 | + | |
| 4169 | + | |
| 4170 | + | |
| 4171 | + | |
| 4172 | + | |
| 4173 | + | |
| 4174 | + | |
| 4175 | + | |
| 4176 | + | |
| 4177 | + | |
4164 | 4178 | | |
4165 | 4179 | | |
4166 | 4180 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
0 commit comments