@@ -311,25 +311,29 @@ fun main(input: Rho) {
311
311
// Rho and Tau interfaces.
312
312
if (unknownObject is Tau ) {
313
313
314
- // Use the overloaded inc() operator from interface Rho,
315
- // which smart-casts the type of unknownObject to Sigma.
314
+ // Use the overloaded inc() operator from interface Rho.
315
+ // In Kotlin 2.0.0, the type of unknownObject is smart-cast to
316
+ // Sigma.
316
317
++ unknownObject
317
318
318
319
// In Kotlin 2.0.0, the compiler knows unknownObject has type
319
320
// Sigma, so the sigma() function can be called successfully.
320
321
unknownObject.sigma()
321
322
322
- // In Kotlin 1.9.20, the compiler thinks unknownObject has type
323
- // Tau, so calling the sigma() function throws an error.
324
-
323
+ // In Kotlin 1.9.20, the compiler doesn't perform a smart cast
324
+ // when inc() is called so the compiler still thinks that
325
+ // unknownObject has type Tau. Calling the sigma() function
326
+ // throws a compile-time error.
327
+
325
328
// In Kotlin 2.0.0, the compiler knows unknownObject has type
326
- // Sigma, so calling the tau() function throws an error.
329
+ // Sigma, so calling the tau() function throws a compile-time
330
+ // error.
327
331
unknownObject.tau()
328
332
// Unresolved reference 'tau'
329
333
330
- // In Kotlin 1.9.20, the compiler mistakenly thinks that
331
- // unknownObject has type Tau, so the tau() function can be
332
- // called successfully .
334
+ // In Kotlin 1.9.20, since the compiler mistakenly thinks that
335
+ // unknownObject has type Tau, the tau() function can be called,
336
+ // but it throws a ClassCastException .
333
337
}
334
338
}
335
339
```
@@ -634,6 +638,8 @@ However, if you don't want to immediately initialize a property, you can:
634
638
* Make the property ` final ` .
635
639
* Use a private backing property that allows for deferred initialization.
636
640
641
+ For more information, see the [ corresponding issue in YouTrack] ( https://youtrack.jetbrains.com/issue/KT-57555 ) .
642
+
637
643
### Deprecated synthetics setter on a projected receiver
638
644
639
645
** What's changed?**
0 commit comments