Commit Graph

1080 Commits

Author SHA1 Message Date
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
Denis.Zharkov b193e708d3 FIR: Refactor checkUpperBoundViolated
There just should be a different facades for cases
A<T1, T2> and foo<T1, T2>()

Test data has changed for type alias constructors since previously,
it was working by mistake because of assumption that type alias arguments
are linearly mapped to the type parameters of the corresponding constructors

^KT-50703 Open
2022-01-11 16:27:03 +03:00
Ivan Kylchik 6fc56477bf Drop all tests that disable features for language version less than 3 2021-12-28 20:08:56 +03:00
Mikhail Glukhikh 0739925869 Drop QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE diagnostic in 1.7.0
#KT-49016 Fixed
2021-12-23 17:45:49 +03:00
Mikhael Bogdanov 7e99ba30f3 Remove obsolete USAGE_OF_JVM_DEFAULT_THROUGH_SUPER_CALL diagnostic
#KT-47000
2021-12-09 11:30:06 +01:00
Mikhail Glukhikh 533e802c8d FIR: support JVM_DEFAULT_WITH_COMPATIBILITY_* diagnostics (FE 1.0 sync) 2021-12-09 13:26:40 +03:00
Mikhail Glukhikh 178290eac3 FIR: drop JVM_DEFAULT_THROUGH_INHERITANCE diagnostic (FE 1.0 sync) 2021-12-09 13:26:39 +03:00
Mikhael Bogdanov a2395ec8bb Additional diagnostics for @JvmDefaultWithCompatibility 2021-12-06 14:20:25 +01:00
Mikhael Bogdanov c0ffbe03c6 Remove '-Xjvm-default-allow-non-default-inheritance' flag. Enable such inheritance by default
#KT-47000 Fixed
2021-12-03 06:39:38 +01:00
Sergej Jaskiewicz 599f705842 [stdlib] Make @LowPriorityInOverloadResolution applicable to ctors 2021-12-02 12:39:40 +00:00
Denis.Zharkov 7eb758fab1 FIR: Avoid propagation of @Exact annotation through elvis 2021-11-26 19:39:52 +03:00
Denis.Zharkov 883b18a0c6 FIR: Preserve non-custom attributes after substitution
The test is being fixed since synthetic call for elvis has @Exact-attribute on return type
2021-11-26 19:39:45 +03:00
Dmitriy Novozhilov 330574cab6 [FIR] Properly support smartcasts on stable when subjects in when conditions
^KT-49860 Fixed
2021-11-26 11:26:21 +03:00
Dmitriy Novozhilov 8707be51c9 [FIR] Report errors about invisible types from type resolution 2021-11-26 11:26:17 +03:00
Dmitriy Novozhilov 9807c67ae4 [FIR] Properly collect overriddens for method enhancement
If some java class has multiple supertypes then we need to collect
  overriddens from all those types directly, even if superTypeScope
  (which is FirTypeIntersectionScope in this case) returns only
  one symbol from one of this types (not intersection one)

This is needed to proper enhancement in cases when some type occurs
  multiple times in supertypes graph with different nullability
  of arguments:

class ConcurrentHashMap<K, V> : AbstractMap<K!, V!>, MutableMap<K, V>

If we try to find method `get(key: K): V` supertype scope returns
  `AbstractMap.get(key: K!): V!` (because it actually overrides
  `MutableMap(key: K): V?`), but we need to get both symbols to
  properly enhance types for `ConcurrentHashMap.remove`
2021-11-22 17:01:17 +03:00
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
Ivan Kochurkin d0a4ca199d [FIR] Add UNCHECKED_CAST
Regenerate diagnostics code
2021-11-12 15:20:45 +03:00
Ivan Kochurkin 2b5524b18f [FIR] Add CAST_NEVER_SUCCEEDS 2021-11-12 15:20:44 +03:00
Ivan Kochurkin 291bc74676 [FIR] Add CANNOT_CHECK_FOR_ERASED 2021-11-12 15:20:43 +03:00
Mads Ager b79ca7d7df [FIR] Allow annotation instantiation.
This commit disables the frontend error reporting for supported cases.
2021-11-09 23:51:48 +03:00
Denis.Zharkov 2e37ec6f0c FIR: Fix false-positive ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL on invokeExtension calls 2021-11-02 19:08:27 +03:00
Denis.Zharkov 37b5237e97 FIR: Fix type alias case for callable reference resolution type 2021-11-02 19:08:26 +03:00
Nikolay Lunyak 0eb2d117ef [FIR] KT-45972, KT-49072: Add visibility checks to the type resolution 2021-10-28 14:31:27 +03:00
Dmitriy Novozhilov f26059a7d3 [FE] Add clear warning about future changes about nullability of safe call with non nullable receiver
^KT-46860
2021-10-27 16:28:37 +03:00
Mikhail Glukhikh b0ec3cb831 Switch off FIR version off REDUNDANT_LABEL_WARNING (performance-related)
This reverts commit 363b2550 (partially)
2021-10-27 12:26:59 +03:00
Tianyu Geng 363b25504d FIR checker: report REDUNDANT_LABEL_WARNING
Since many labels are not present in the FIR tree, this checker is
implemented as a syntax checker. Comparing with FE1.0, this change
reports some REDUNDANT_LABEL_WARNING that FE1.0 has missed, especially
LHS of assignments.
2021-10-25 13:51:01 +03:00
Mikhail Glukhikh 7b9ac4c5f7 FIR: create constructors copies with correct containers in JvmMappedScope
#KT-49133 Fixed
2021-10-23 01:17:10 +03:00
Ilmir Usmanov 2b8963455f Use a separate diagnostic for 'suspend fun' sequence
instead of reusing existing one, since existing one
is ERROR, and we cannot turn code red without deprecating
it with WARNING.
 #KT-49264
2021-10-20 18:12:10 +02:00
Ilmir Usmanov 559d7015f7 Extend NON_MODIFIER_FORM_FOR_BUILT_IN_SUSPEND diagnostic
to include "suspend fun" token sequence as well
2021-10-14 12:44:18 +00:00
Denis.Zharkov cac69edff2 FIR: Fix forEach resolution within local class 2021-10-14 14:01:51 +03:00
Mikhail Glukhikh 7243d30869 Split property use-site targets during FIR building 2021-10-12 16:22:58 +03:00
Mikhail Glukhikh d3662b48a2 FIR: fix OPT_IN_MARKER_ON_WRONG_TARGET (setter via parameter case)
This commit fixes FIR bootstrap compilation
2021-09-30 14:58:14 +03:00
Mikhail Glukhikh 212c3e8d51 FIR: fix OPT_IN_MARKER_ON_WRONG_TARGET for constructor properties 2021-09-29 19:39:28 +03:00
Mikhail Glukhikh e9bff861dd FIR: report OPT_IN_MARKER_ON_OVERRIDE diagnostic
This diagnostic works in accordance with KT-45844 and KT-49002
2021-09-29 19:39:27 +03:00
Mikhail Glukhikh ac3b738d9b FIR: report OPT_IN_OVERRIDE(_ERROR) diagnostics 2021-09-29 19:39:25 +03:00
Mikhail Glukhikh 056f74a23b FE 1.0: allow OptIn marker on override if base class is marked
#KT-49002 Fixed
2021-09-29 19:39:24 +03:00
Mikhail Glukhikh a76aee9b69 FIR: spread OptIn markers to children except fake override case
This commit implements KT-49001 for FIR
2021-09-29 19:39:23 +03:00
Mikhail Glukhikh 69e06a242a FE 1.0: spread OptIn markers to children except fake override case
#KT-49001 Fixed
2021-09-29 19:39:22 +03:00
Mikhail Glukhikh 3045a5e920 FIR: implement OPT_IN_MARKER_ON_WRONG_TARGET 2021-09-29 19:39:20 +03:00
Denis.Zharkov 6e6be7c953 FIR: Adjust test data
Currently, we've got two places where NO_COMPANION_OBJECT is reported
and they perform it kind of differently
2021-09-14 19:13:40 +03:00
Ivan Kochurkin 5760a94ab4 [FIR] Add CONCURRENT_HASH_MAP_CONTAINS_OPERATOR 2021-09-13 20:48:58 +03:00
Ivan Kochurkin 0ffd6ccb34 [FIR] Add SUSPENSION_POINT_INSIDE_CRITICAL_SECTION 2021-09-13 20:48:57 +03:00
Ivan Kochurkin e97933a9e5 [FIR] Add POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION 2021-09-13 20:48:55 +03:00
Ivan Kochurkin dd46c36b24 [FIR] Add SUBCLASS_CANT_CALL_COMPANION_PROTECTED_NON_STATIC 2021-09-13 20:48:54 +03:00
Dmitriy Novozhilov 5769d42248 [FIR] Fix all usages of annotations due to new FirAnnotation hierarchy 2021-09-13 13:53:12 +03:00
Mikhail Glukhikh fc6403679a Rename !USE_EXPERIMENTAL test directive to !OPT_IN 2021-09-10 16:29:16 +03:00
Mikhail Glukhikh 3febabe977 Use OPT_IN instead of EXPERIMENTAL in diagnostic names 2021-09-10 16:29:13 +03:00
Ivan Kochurkin 55f33999f1 [FIR] Add REPEATED_ANNOTATION, REPEATED_ANNOTATION_WARNING 2021-09-10 00:49:07 +03:00
Ivan Kochurkin f414a91c66 [FIR] Implement FirInterfaceDefaultMethodCallChecker
Add diagnostics: INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET,
INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER,
DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET
2021-09-10 00:49:04 +03:00
Ivan Kochurkin 2baed77598 [FIR] Add JVM_SYNTHETIC_ON_DELEGATE diagnostic
Extract JVM names to common JvmNames
2021-09-10 00:49:03 +03:00