Files
kotlin-fork/compiler/frontend
Nikita Bobko 58e1c4c6ac [FIR] Kmp: Deprecate header/impl keywords
Review: https://jetbrains.team/p/kt/reviews/14224/timeline

Timeline:
**(1)** Kotlin 1.1.60 https://github.com/JetBrains/kotlin/commit/59efedf610a25b004edf3d19897ce4dfca28ddb2 `header` keyword is introduced (committed on Dec 13, 2016)
**(2)** Kotlin `header`/`impl` has been deprecated (warning) at least since 1.1.60 https://github.com/JetBrains/kotlin/commit/5d251062677e09d607f295189b7978d5833e448f (committed on Sep 15, 2017)
**(3)** 1.1.60 release https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-compiler/1.1.60/ Nov 13, 2017

It sounds stupid but it looks like `header` was introduced and
deprecated right in the same release. Though it may be possible that we
had a release between **(1)** and **(2)** that I couldn't find

Anyway the keywords have been deprecated since basically forever

The fix is not perfect

"The perfect fix" would be:
1. Introduce a separate `DEPRECATED_MODIFIER_ERROR` diagnostic
2. Introduce LanguageVersionSettings for the `DEPRECATED_MODIFIER_ERROR`
   diagnostic

But "the perfect fix" requires:
1. Adopting `ReplaceModifierFix` in the IDE to make it work with the new
   diagnostic. `ReplaceModifierFix` is only implemented in K1 IDE. So
   there are two ways:
   1. Create a KTIJ ticket to port the diagnostic to K2 IDE (it needs to
      be ported anyway), and **mention** in the ticket that
      `DEPRECATED_MODIFIER_ERROR` also needs to be supported in K2 IDE.
      It's the ticket that nobody will probably find and fix
   2. Go and port `ReplaceModifierFix` to K2 IDE myself. It's fairly
      simple task, but I've not worked in intellij for quite a while,
      and it will take me too much time to index and compile

Considering that DEPRECATED_MODIFIER diagnostic is used only to report
`header`/`impl`, and there are literally 0 known cases when people use
it. It's just easier to convert the diagnostic to error in K2

Related tests:
- compiler/testData/diagnostics/tests/multiplatform/deprecated/header.kt

^KT-59839 Fixed
2024-02-08 16:34:27 +00:00
..