Files
kotlin-fork/compiler
Marco Pennekamp c9461a3827 [JVM IR] KTIJ-24206 Add an option to stub orphaned expect symbols
- The cause for KTIJ-24206 is that the `expect` function's parent is an
  `IrFile` instead of an `IrClass`. This is because
  `ExpectDeclarationsRemoveLowering` removes `expect` declarations
  before `FileClassLowering` can replace `IrFile` parents.
- That behavior is normally okay, but breaks down when an `expect`
  declaration has no associated `actual` declaration. In such cases,
  `ExpectDeclarationsRemoveLowering` doesn't replace `expect` symbols in
  expressions with their corresponding `actual` symbols, as it normally
  would.
- The solution fills in `ExpectDeclarationsRemoveLowering`'s behavior
  by replacing `expect` symbols for which no `actual` symbols exist with
  stubs. See `stubOrphanedExpectSymbols`.
- To not mess with the lowerings, `stubOrphanedExpectSymbols` is invoked
  during IR generation. It uses the same `ExpectSymbolTransformer`
  as `ExpectDeclarationRemover`.

^KTIJ-24206 fixed
2023-02-03 12:23:09 +00:00
..
2023-02-01 15:13:34 +01:00
2023-02-01 15:13:34 +01:00