I upgraded the Kotlin plugin in IDEA from 1.2.71 to 1.3.0 and made sure the new SDK is the Project SDK:
I expected to be able to use the new kotlin.contracts.contract
, but it's deep red!
Information:Kotlin: kotlinc-jvm 1.3.0 (JRE 1.8.0_181-b13)
Error:(9, 9) Kotlin: Error in contract description: Error in contract description
Error:(9, 9) Kotlin: Unresolved reference: contract
What do I have to do to get access to contracts?
The language level of the project does not get migrated automatically. Therefore, new language features will not be available (and your code won't break) unless you do something.
Change the language level for your project manually in File | Settings | Build, Execution, Deployment | Compiler | Kotlin Compiler:
Or add a facet to the modules you want to selectively change the level for:
Further steps are necessary to enable contracts which are, after all, an experimental feature, but IDEA will now help you with that: