Commit Graph

3541 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy d44a7ff8f9 Add test for obsolete issue
The issue was fixed in df1595e

 #KT-39630 Fixed
2020-06-18 13:05:42 +03:00
Mikhail Zarechenskiy df1595e4bc Fix SAM conversions for derived classes
#KT-39535 Fixed
 #KT-37149 Fixed
2020-06-18 12:36:30 +03:00
Victor Petukhov 901b794af3 Use lexical scope from trace during checking suspend context if the analysis of engaged parent function isn't completed
^KT-39461 Fixed
2020-06-16 22:00:04 +03:00
simon.ogorodnik 1a7b30c13a [FIR] Fix incorrect name in anonymous object class id 2020-06-16 00:01:06 +03:00
Dmitriy Novozhilov d7ee168dff [FIR] Create error candidate for completion instead of simple error reference 2020-06-15 15:32:25 +03:00
Denis Zharkov 293f78efe8 FIR: Correct capturing for type-alias bases arguments
NB: The test data change at testData/diagnostics/tests/typealias/noApproximationInTypeAliasArgumentSubstitution.fir.kt
is correct: see the relevant non-fir test, the call shouldn't be applicable

^KT-39008 Fixed
2020-06-11 11:31:38 +03:00
Denis Zharkov 72b09ff323 FIR: Rename FirSuperTypeScope and reuse it for type parameter type
It would allow ConeKotlinType.scope return FirTypeScope
and thus pulling down org.jetbrains.kotlin.fir.scopes.FirScope#processOverriddenFunctions
(See the following commits)
2020-06-11 11:31:31 +03:00
Denis Zharkov 38922a84f1 FIR: Do not create synthetic properties for non-Java accessors
^KT-35495 Fixed
2020-06-11 11:01:43 +03:00
Mikhail Zarechenskiy 3921a0ed70 Add test for obsolete issue
#KT-17341 Obsolete
 #KT-32958 Obsolete
2020-06-10 16:00:23 +03:00
Mikhail Zarechenskiy a086d9f7df Update forgotten FIR test 2020-06-05 16:30:09 +03:00
Mikhail Zarechenskiy 6c5806f971 Add test for obsolete issue
#KT-38161 Obsolete
2020-06-05 16:30:08 +03:00
Mikhail Zarechenskiy 22b558110d Don't apply Unit-conversion for expressions that return Nothing type 2020-06-05 15:59:31 +03:00
Mikhail Zarechenskiy fb812301b2 Add test to preserve behaviour
It's important to have ambiguity in these cases to introduce overload
 resolution by suspend-modifier without breaking changes in future

 Relates to #KT-23610
2020-06-05 14:07:08 +03:00
Mikhail Zarechenskiy bfa648972f Introduce call checker for Unit-conversions 2020-06-05 13:24:21 +03:00
Mikhail Zarechenskiy 6b0a803d14 Allow suspend-conversion for callable references as part of adaptation 2020-06-05 13:24:21 +03:00
Mikhail Zarechenskiy 71cbe97688 Introduce Unit-conversions for simple arguments 2020-06-05 13:24:20 +03:00
Mikhail Zarechenskiy a4af833d55 Narrow down the range for compatibility warning to callee expression 2020-06-05 13:24:19 +03:00
Mikhail Zarechenskiy 718f23b34f Compatibility warning for references to companion via name (KT-13934) 2020-06-05 13:24:18 +03:00
Ilmir Usmanov 8cc5f2abfb Forbid val field initialization inside EXACLTY_ONCE lambda
unless the lambda is inline. This way, final field will remain final.
2020-06-04 21:26:48 +02:00
Denis Zharkov 55a4c40970 FIR: Fix diagnostics test data after safe-call refactoring
^KT-38444 In Progress
2020-06-03 10:43:37 +03:00
Victor Petukhov 8d05253369 NI: take into account effective variance during adding constraints from LHS instead of only use site variance
^KT-39220 Fixed
2020-06-01 17:24:49 +03:00
Mikhail Zarechenskiy f073e34926 Update forgotten test-data 2020-06-01 15:35:24 +03:00
Mikhail Zarechenskiy 569b6eaff2 Don't issue compatibility warning for the candidates in the same group 2020-06-01 10:19:35 +03:00
Mikhail Zarechenskiy 599f520fd8 Add compatibility warning for chained sam->suspend-conversion 2020-06-01 10:19:35 +03:00
Mikhail Zarechenskiy a5203428a4 Replace resolution error for suspend-conversion with call checker error 2020-06-01 10:19:34 +03:00
Mikhail Zarechenskiy eaeaf3c8a3 Add compatibility warning for suspend conversions 2020-06-01 10:19:33 +03:00
Mikhail Zarechenskiy 47e6805186 Add compatibility warning for reference adaptation 2020-06-01 10:19:33 +03:00
Mikhail Zarechenskiy 03358c61d4 Add compatibility warning for SAM conversions 2020-06-01 10:19:33 +03:00
Mikhail Zarechenskiy 01de789c76 Add compatibility warning for SAM conversions on Kotlin functions 2020-06-01 10:19:32 +03:00
Victor Petukhov d7f52e8b67 NI: do explicit incorporation of type of fixing type variable into other constraints
^KT-37380 Fixed
2020-05-27 15:44:03 +03:00
Yan Zhulanow ef698a5747 Fix "PSI/index mismatch" in case of @ParameterName on non-functional types (KT-34524) 2020-05-27 02:38:41 +09:00
Victor Petukhov e70242f6f1 NI: some review fixes for improved postponed arguments analysis 2020-05-25 19:37:30 +03:00
Victor Petukhov 756326cefe NI: report error diagnostic about impossible to infer anonymous function's parameter
Partially fixed KT-39098
2020-05-25 19:37:27 +03:00
Mikhail Zarechenskiy 2cee82a348 [NI] Resolve receiver of provideDelegate independently
#KT-38259 Fixed
2020-05-25 16:06:55 +03:00
Victor Petukhov 379c6944a2 NI: extract diagnostics from partially resolved call instead of separately handling it including running all checks
^KT-37630 Fixed
^KT-35494 Fixed
2020-05-22 22:13:53 +03:00
anastasiia.spaseeva d32aca87d1 [Spec tests] Change metadata structure of implementation and spec tests 2020-05-22 02:51:57 +03:00
Mikhail Likholetov 80cd26c9df [FIR] Support several annotation class diagnostics 2020-05-21 18:01:36 +03:00
Pavel Kirpichenkov 0b33e9430b [NI] Report unstable smart cast directly instead of using SmartCastManager
Fix compilation errors, revealed by this fix.

SmartCastManager is unnecessary for error reporting, intermediate diagnostics from the NI contain all required infromation.
When SmartCastManager is used it leads to missing unstable smart casts in case of expressions with captured types.
This happens, because data flow info is recorded for original expression without captured types, which is used as a key.
DataFlowValues created from receivers with captured types can't be used to retrieve that info.

^KT-39010 Fixed
2020-05-21 17:09:10 +03:00
Victor Petukhov 12db3d6e83 NI: remove separation of variable fixation order by constraint kind
The commit partially reverts ec4d9d2f1f

^KT-37914 Fixed
2020-05-20 22:37:30 +03:00
Mikhail Zarechenskiy 8bdc4d34f7 [NI] Commonize type-conversions (SAM/Suspend)
- Allow participating subtypes of functional types in conversions
 - Fix several subtle inconsistencies
 - Place logic about conversions at one place

 Now conversions operations have two stages: before usual subtyping
 check and after one. This is needed to support conversions of
 subtypes (of functional types, for example). First, the compiler
 checks if it possible to resolve an argument without conversion and
 only then it tries to perform conversion.
 Note that it'd be incorrect to perform conversion eagerly as it can
 change resolve (Runnable & () -> Unit <: KRunnable), plus we can't
 guess whether conversion is needed at all as it's important not to
 look into supertypes if resolution doesn't actually needed it

 #KT-36448 Fixed
 #KT-37574 Fixed
 #KT-38604 Fixed
2020-05-20 15:30:14 +03:00
Victor Petukhov eff5f3a242 NI: do type checking for anonymous functions not inside a call
^KT-38890 Fixed
^KT-38439 Fixed
2020-05-19 16:29:14 +03:00
Denis Zharkov e1e149a062 FIR: Support coercion-to-unit semantics for callable references 2020-05-18 11:17:45 +03:00
Denis Zharkov b691b13d8e FIR: Add separate local scopes for blocks 2020-05-15 16:04:44 +03:00
Denis Zharkov 808355d817 FIR: Fix test data for secondary constructor delegation calls
They appeared, after the changes in previous commits at
org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer#transformDelegatedConstructorCall

The idea is that dispatch receiver is available there in old FE, but additional
diagnostic should be reported on it (see KT-38813)

This change was not made intentionaly but it was the easiest way to
support new tower data elements structure and on the other side it's the
correct behavior as for old FE.

Also, if we once would prefer the previous behavior it's still not very
hard to support it
2020-05-15 16:04:44 +03:00
Denis Zharkov f71a56e742 FIR: Fix test data after rewritten scope structure
Mostly, the semantics for statics/companions has been changed there
Fixed test data now is much closer to semantics of old FE
2020-05-15 16:04:44 +03:00
Denis Zharkov 687a58843f FIR: Rewrite visibility checking
Unbound it from implicit receiver stack as it only needs scope structure/declaration nestedness
Semantics for protected has been changed in a way it works in old FE

NB: We should report additional diagnostic in case of CallCompanionProtectedNonStatic.fir.kt
(see KT-38814)
2020-05-15 16:04:44 +03:00
Victor Petukhov 73dec25eb1 NI: intersect DFI types before capturing
^KT-37887 Fixed
2020-05-14 19:54:59 +03:00
Mikhail Glukhikh 457fb09e3a [FIR] Use tower to resolve delegated constructors, set dispatch receiver 2020-05-12 16:57:07 +03:00
Pavel Kirpichenkov 003ba1c8f5 [NI] CST: add preemptive recursion detection
For single super type constructor create star projection argument when types for that argument are equal to the original types.
Captured star projections are replaced with their corresponding supertypes during this check.
Skip check for `in` parameters, for which recursive cst calculation does not happen.
Adjust constant in fallback recursion condition.

^KT-38544 Fixed
2020-05-12 11:13:43 +03:00
Victor Petukhov b49dc46e6c NI: improve reporting errors about mismatch number of anonymous function parameters 2020-05-09 12:34:08 +03:00