Commit Graph

5674 Commits

Author SHA1 Message Date
Mikhael Bogdanov 15e08893aa FIR: support DefinitelyNotNull types
#KT-49465 Fixed
2022-02-03 14:07:20 +01:00
Mikhail Glukhikh 029e946fb2 FIR: report VAL_REASSIGNMENT on synthetic immutable properties
#KT-50972 Fixed
2022-02-01 18:48:50 +03:00
Denis.Zharkov adb9dfb256 FIR: Rework processing AugmentedArraySetCall
Previously (few commits earlier), it contained two versions
of receiver (lhs) generated separately for each desugaring version
that looked a bit redundant.

Now, at FIR building stage we just don't create desugaring sub-trees,
instead they are being built during bodies transformation and that seems
to be much convenient there, since we don't need to reverse-engineer
get-set-operator version to check if containing calls are successful
(as we just built those calls and retain them)

Semantically, this changes may only change how data flow works
for such statements (see changed compatibilityResolveWithVarargAndOperatorCall.kt)

^KT-50861 Relates
2022-02-01 13:12:49 +03:00
Mikhail Glukhikh c2f43dd98e Revert OPT_IN_MARKER_ON_OVERRIDE limitation #KT-48890 Fixed 2022-01-28 13:40:35 +00:00
Mikhail Glukhikh fd3d86eddf FE 1.0: introduce deprecation for Enum.declaringClass (KT-49653) 2022-01-27 17:27:40 +03:00
Mikhail Glukhikh 983fa4c8c7 FIR: add temporary access to Enum.getDeclaringClass (see KT-49653) 2022-01-27 17:27:39 +03:00
Mikhail Glukhikh c2ab09fa84 Add test for KT-49653 2022-01-27 17:27:38 +03:00
Victor Petukhov 1a23cd8c45 [FE 1.0] Don't try to report specialized resolution ambiguity error for builder inference if the corresponding substitutor is empty
^KT-50989 Fixed
2022-01-27 15:30:16 +03:00
Dmitriy Novozhilov d1fb8338ef [FIR] Infer type of elvis from lhs if rhs is Nothing
^KT-50875 Fixed
2022-01-23 08:22:07 +03:00
Ivan Kochurkin defb0cf611 [FIR] Fix ambiguity between Sequence.forEach and Iterable.forEach (with @HidesMembers) ^KT-50776 Fixed 2022-01-21 19:34:10 +03:00
Anastasia.Shadrina a86b4d767e [FE] KT-50878 Prohibit using contextual declarations without -Xcontext-receivers 2022-01-21 17:21:59 +03:00
Mikhail Glukhikh e8be9d4861 FIR: support don't use builder inference if possible
In this commit we upgrade FIR builder inference logic from
the compiler version to 1.7. FIR-based compiler now works with
"don't use builder inference" flag always ON and supports switching
the flag "use builder inference only if needed". To do it,
ContraintSystemCompleter (FIR) and KotlinConstraintSystemCompleter (FE 1.0)
are made similar with extracting some common parts into
ConstraintSystemCompletionContext.

Test status: one BB test fails after this commit (KT-49285).
Also we have a crush in DFA logic in FIR bootstrap test and somehow
questionable behavior in FIR diagnostic test. However,
two BB tests were fixed, the 3rd case from KT-49925 were also fixed.

#KT-49925 Fixed
2022-01-20 23:46:36 +03:00
Dmitriy Novozhilov cd578e9d13 [FIR] Fix inference in presence of Unit expected type 2022-01-20 11:25:47 +03:00
Dmitriy Novozhilov 1a3841d66d [FIR] Properly enhance raw Class type in java annotations 2022-01-20 11:25:44 +03:00
Dmitriy Novozhilov 239a330ddd [FE 1.0] Add test for KT-50850 2022-01-20 11:25:41 +03:00
Dmitriy Novozhilov 345fdc214b [FIR] Store enhanced functions and properties in session component
Previously enhanced symbols were cached inside SignatureEnhancement,
  which is created independently for each enhancement scope. This may
  cause creation of multiple enhanced symbols for same java declaration
  in presence of multiple scope sessions (mutithread compiler, IDE,
  separate scope session for checkers)

^KT-50858 Fixed
2022-01-19 15:24:43 +03:00
Dmitriy Novozhilov 4f967ce102 [FIR] Ignore test due to KT-50858 2022-01-19 15:24:43 +03:00
Dmitriy Novozhilov c80cfb0fdb [FIR] Replace single supertype scope with list of scopes of supertypes in use site scopes
This big refactoring is needed to cleanup building of overrides
  mappings and prevent creating redundant intersection overrides in
  cases when there is no need in them:

```kotlin
interface A {
    fun foo()
}

interface B {
    fun foo()
}

interface C : A, B {
    override fun foo()
}
```

Before this refactoring there was next override tree:
C.foo
  intersection override (A.foo, B.foo)
    A.foo
    B.foo

Also this commit fixes special mapping of overrides in jvm scopes
  for declarations which have kotlin builtins in supertypes with
  special java mapping rules (collections, for example)
2022-01-19 15:24:43 +03:00
Pavel Kirpichenkov b4c854429f [MPP] Permit const actual properties for non-const expects
It's safe as not having const is more restrictive, therefore can be
allowed in common. Otherwise, it's not possible to declare an expect
declaration for a platform property with `const` modifier in common

KT-18856
2022-01-19 13:22:47 +03:00
Pavel Kirpichenkov a46e683c85 [MPP] Add tests for const vs non-const expect and actual properties
KT-18856
2022-01-19 13:22:46 +03:00
Denis.Zharkov b2543b7a26 Fix false negative UPPER_BOUND_VIOLATED with typealiases in supertypes
^KT-50797 Fixed
^KT-50798 Open
2022-01-19 09:52:16 +03:00
Dmitriy Novozhilov 5fc1e2e0cb [FIR] Don't create DNN types for flexible simple types
^KT-50788
2022-01-18 13:41:31 +03:00
Victor Petukhov 72a78eb423 Replace errors with warnings for type checker recursion on delegates
^KT-49477 Fixed
2022-01-17 21:27:14 +03:00
Victor Petukhov a4a2f71fca Introduce deprecation cycle for reporting errors on some illegal equality calls inside a builder inference call
^KT-43493 Fixed
2022-01-17 19:44:16 +03:00
Victor Petukhov 060af85a93 Extract checks on equality expressions into a separate checker
^KT-43493 Fixed
2022-01-17 19:44:16 +03:00
Dmitriy Novozhilov 57346bac54 [FIR] Properly handle flexible types during creation of DNNT
^KT-50788 Fixed
2022-01-17 17:59:22 +03:00
Mikhail Glukhikh 1274e2b90a Deprecate ExtensionFunctionType on a non-function types
Related to KT-43527
2022-01-14 22:20:44 +03:00
Mikhail Glukhikh d0fa3eb1d3 Forbid ExtensionFunctionType on functional types without parameters
#KT-43527 Fixed
2022-01-14 22:20:24 +03:00
Mikhail Glukhikh 1402bb2d45 Fix error message about unsupported annotations on type parameters
#KT-48908 Fixed
2022-01-14 22:20:22 +03:00
Mikhail Glukhikh fdf336042b Provide migration of Any functions via super in abstract case
Related to KT-38078
2022-01-14 22:20:21 +03:00
Mikhail Glukhikh 390fa682b9 Forbid calls of Any functions via super if they are overridden as abstract
#KT-38078 Fixed
2022-01-14 22:20:21 +03:00
Mikhail Glukhikh b689bbf5c7 Forbid usages of super if in fact it accesses an abstract member
#KT-49017 Fixed
2022-01-14 22:20:21 +03:00
Evgeniy.Zhelenskiy e97ca2ada4 [Psi2Ir, Fir2Ir] Generate toString, hashCode, equals methods for MF VC 2022-01-14 13:51:57 +00:00
Evgeniy.Zhelenskiy c7edc353d3 [FIX, Frontend] Fix recursive check for multi-field value classes 2022-01-14 13:51:57 +00:00
Evgeniy.Zhelenskiy df1de3a7d3 [JVM] Forbid non-JvmInline value classes again 2022-01-14 13:51:56 +00:00
Evgeniy.Zhelenskiy 7595f798e1 [JVM] Introduce MF Value Classes to frontend 2022-01-14 13:51:55 +00:00
Dmitriy Novozhilov bb6c6dc45d [FE 1.0] Fix reporting of UNINITIALIZED_ENUM_ENTRY on qualified enums
^KT-41124
^KT-50758 Fixed
2022-01-14 14:26:54 +03:00
Dmitriy Novozhilov 9f870b0549 [FIR] Report errors on cycles in annotation parameter types
^KT-47932
2022-01-14 14:26:53 +03:00
Dmitriy Novozhilov e9ac24dc33 [FE 1.0] Report errors on cycles in annotation parameter types
^KT-47932
^KT-50753 Fixed
2022-01-14 14:26:52 +03:00
Dmitriy Novozhilov 139a800ff7 [FE 1.0] Prohibit array literals inside nested objects of annotation classes
^KT-39041
^KT-50749 Fixed
2022-01-14 14:26:51 +03:00
Dmitriy Novozhilov c1575edca4 [FE 1.0] Drop ArrayLiteralsInAnnotations feature
This feature was introduced in 1.2, so now it's stable part of language
  and we can drop support of disabling it
2022-01-14 14:26:50 +03:00
Dmitriy Novozhilov ff7eb79bb1 [FE 1.0] Prohibit call of constructor of functional supertype
^KT-46344
^KT-50730 Fixed
2022-01-14 14:26:50 +03:00
Dmitriy Novozhilov ecc890efe8 [FE 1.0] Fix reporting of uninitialized parameter in default values of parameters
^KT-25694
^KT-50723 Fixed
2022-01-14 14:26:49 +03:00
Denis.Zharkov 964cf937c3 Fix IllegalStateException in case of recursive T & Any upper bound
^KT-50542 Fixed
2022-01-13 12:54:47 +03:00
Denis.Zharkov d87eddaf8b Improve warnings related to type parameter bounds nullability
Explicitly supply the type parameter that needs to be non-nullified

^KT-36770 Relates
2022-01-13 08:47:20 +03:00
Dmitriy Novozhilov b2b5f4a63a [FE 1.0] Don't report deprecation diagnostics about enum on it's own entries
^KT-37975 Fixed
2022-01-12 19:11:28 +03:00
Victor Petukhov 1f1b5256b0 Postpone type enhancement improvements till 1.7 due to some found broken cases unmarked by warnings before
^KT-49378 Fixed
2022-01-12 15:58:50 +03:00
Denis.Zharkov a33d9df0cd NI: Support forking inference with heuristics
Mostly, it only affects FIR

It partially allows to consider several variance of constraints like
A<Int> & A<T> <: A<X_var> that are mostly brought by smart casts

^KT-49542 Fixed
^KT-50489 Relates
2022-01-11 20:45:55 +03:00
Victor Petukhov 455b3143e7 [FE 1.0] Introduce builder inference stub types checker which may report more precise and clear errors due to resolution ambiguity
^KT-49828 Fixed
2022-01-11 18:34:47 +03:00
Victor Petukhov 8e2b90b5db [FE 1.0] Don't report CAST_NEVER_SUCCEEDS on stub types
^KT-49829 Fixed
2022-01-11 18:34:41 +03:00