Commit Graph

291 Commits

Author SHA1 Message Date
Denis.Zharkov 33dcbaac16 K2: Change resolution rules of when/if expressions with expected type
When expected type is known, use it as expected type for branch bodies.
While it indeed becomes different from the usual select call resolution,
where expected type is applied only after completion starts,
it helps to support, e.g. callable references resolution just as powerful
as it was in K1.

Also, in some cases where diagnostics have been changed, they become
a bit more helpful since they are reported closer
to the problematic places

cannotCastToFunction.kt test has been removed because it relied
on the case erroneously supported by the hack removed from
the FirCallResolver in this commit.

^KT-45989 Fixed
^KT-55936 Fixed
^KT-56445 Fixed
^KT-54709 Related
^KT-55931 Related
2023-02-15 08:13:46 +00:00
Denis.Zharkov a38040680c K2: Do not use KFunctionN as representation type for adapted references
Beside some corner cases, it's already prohibited in K1 because
adaptation have a bit strange nature
(they don't represent any existing real function exactly)

^KT-55137 Fixed
2023-02-15 08:13:45 +00:00
Denis.Zharkov dcdc48a233 K2: Support callable references adaptation on top-level
^KT-45989 In progress
^KT-54709 Related
^KT-55217 Fixed
2023-02-15 08:13:44 +00:00
Kirill Rakhman 1eb18f13bd FIR: Fix test data after making LHS of assignment an expression
KT-54648
2023-01-31 08:39:43 +00:00
Ilya Kirillov 1bbcae5ed2 [FIR] fix resolve contract violation from scopes
We cannot call lazy resolve to STATUS phase from scopes as scopes may be accessed on a STATUS phase or earlier

^KT-54890
^KTIJ-23587 fixed
2023-01-13 21:32:51 +00:00
Ilya Kirillov 644d1bf0d0 [FIR] ignore tests which fail because of resolve contracts violation 2022-12-12 16:21:07 +00:00
Dmitriy Novozhilov bd3a28d04d [FE 1.0] Report INTEGER_OPERATOR_RESOLVE_WILL_CHANGE in missing cases
Covered places:
- local properties
- vars
- return positions of functions and lambdas

^KT-45970 Fixed
^KT-55358 Fixed
2022-12-09 15:10:03 +00:00
Mikhail Glukhikh 2a1a5c6936 EmptyIntersectionTypeChecker: drop questionable check of arguments
The situations with conflicting type arguments normally don't provoke
any runtime problems. Also, conflicts like A<T> VS A<SomeType> aren't
valid at all. Here we decided to remove them to avoid strange
and non-actionable warnings in user code.

#KT-54411 Fixed
2022-12-09 15:00:40 +00:00
Marco Pennekamp d4e6a4ad54 [FIR] KT-54978 Prohibit explicit type arguments in property accesses
- Add a checker which ensures that property accesses have no explicit
  type arguments. If an error on the property access's callee reference
  already exists, the new error is not reported in favor of the existing
  error, as the property access may have been intended to be a function
  call.
- `complicatedLTGT.fir.kt`: The underlying parser issue is not yet
  solved, which is why `x` is parsed as a property access with explicit
  type arguments.
- `reservedExpressionSyntax` tests: This new check makes a lot of the
  access expressions in these tests illegal, so valid lines have been
  added and invalid lines appropriately marked with
  `EXPLICIT_TYPE_ARGUMENTS_IN_PROPERTY_ACCESS` errors.

^KT-54978 fixed
2022-11-29 14:47:59 +00:00
Denis.Zharkov 2953e600ff K1: Deprecate incorrect callable references resolution behavior
^KT-54316 Related
^KT-54832 Fixed
2022-11-15 15:06:58 +00:00
Pavel Mikhailovskii f4bdf54601 KT-8575 Fix warnings for Java synthetic properties 2022-10-10 22:03:58 +00:00
Nikolay Lunyak fcd3e4f4c5 [FIR JS] KT-51740: Alter positioning of NO_VALUE_FOR_PARAMETER 2022-09-30 21:39:20 +03:00
Mikhail Glukhikh 32a73968de Stop tower resolve in K2 in more similar manner with K1 2022-07-27 15:29:41 +00:00
Victor Petukhov 42e71f8c53 Remove explicit enabling the new type inference from test data 2022-07-22 16:03:52 +00:00
Victor Petukhov 224beb24eb Remove explicit disabling the new type inference from test data 2022-07-22 16:03:51 +00:00
Mikhail Glukhikh d16e5e5e50 FIR: Support checking PRIVATE_TO_THIS visibility #KT-49875 Fixed 2022-07-15 07:57:41 +00:00
Victor Petukhov 0199c76c06 [FE 1.0] Check callable reference return type safety during resolution
^KT-51844
^KT-52503 Fixed
2022-05-27 13:56:34 +00:00
Ivan Kylchik 51ccc32a3f Update test data after introducing IntrinsicConstEvaluation annotation 2022-05-18 21:19:57 +03:00
Victor Petukhov 5bfe6cd20a [FE] Implement discussed rules to report empty intersection errors 2022-04-27 19:50:22 +00:00
Ivan Kochurkin c6f52893fb [FIR] Fix inconsistent RETURN_TYPE_MISMATCH and TYPE_MISMATCH reporting on functions and properties
^KT-51203 Fixed
2022-04-05 15:50:43 +00:00
Victor Petukhov 27fa632630 [FE 1.0] Update test data with new error type representation 2022-03-23 21:13:33 +00:00
Mikhail Glukhikh b327f5c731 Substitute type variables properly in ConeOverloadConflictResolver
#KT-46187 Fixed
2022-03-23 09:54:46 +00:00
Dmitriy Novozhilov ade2307345 [FIR] Fix exponential analysis of augmented array access calls
^KT-50861 Fixed
2022-03-11 15:36:05 +03:00
Ivan Kochurkin f751f13c4d [FIR] Fix incompatible KClass<Any> and callable reference Collection::class, ^KT-51272 Fixed 2022-02-23 14:21:59 +03:00
Ivan Kochurkin a0510f4a67 [FIR] Fixed Replace ConeTypeVariable on ConeTypeParameter ^KT-51017
in AbstractConeCallConflictResolver.computeParameterTypes
2022-02-07 17:21:59 +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 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
Ivan Kylchik 6fc56477bf Drop all tests that disable features for language version less than 3 2021-12-28 20:08:56 +03:00
Dmitriy Novozhilov f2c319c4ae [FIR] Add ability to safe proper ConeKotlinType in FirErrorTypeRef
This is needed for cases when some type ref is resolved to proper type
  but has some diagnostic (e.g. this type is invisible)
2021-11-26 11:26:16 +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
Denis.Zharkov 6e15ee8fea FIR: Refine callable reference resolution in assignment position
synthetic_select<() -> T>(::foo) form allows to select better candidate
than synthetic_select(::foo) with expect type `() -> T`
2021-11-10 22:00:01 +03:00
Victor Petukhov 02d06b6390 Transform VisibilityError diagnostic for callable references to further report it on the corresponding argument of a base call
^KT-46437 Fixed
2021-10-26 19:37:57 +03:00
Victor Petukhov abd2507107 Don't discriminate generics during callable references resolution
^KT-49038 Fixed
2021-10-01 22:09:33 +03:00
Victor Petukhov ee728b6902 Use the new type inference for top-level callable reference resolution
^KT-47797 Fixed
^KT-47987 Fixed
^KT-45034 Fixed
^KT-48446 Fixed
^KT-13934 Fixed
2021-09-27 16:12:27 +03:00
Ivan Kochurkin 84c5f58cab [FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER 2021-08-25 21:53:23 +00:00
Ivan Kochurkin bb27ae2b42 [FIR] Fix incorrect resolve of callable reference in function signature (^KT-48304 Fixed) 2021-08-25 21:53:23 +00:00
Mikhail Glukhikh 4e4d36f85a FIR: take lower priority into account during references EagerResolve
#KT-48158 Fixed
2021-08-13 11:14:04 +03:00
Ivan Kochurkin d4e1cded59 [FIR] Implement RESOLUTION_TO_CLASSIFIER 2021-07-28 23:18:38 +03:00
Ivan Kochurkin 173813f7cf [FIR] Implement REIFIED_TYPE_FORBIDDEN_SUBSTITUTION 2021-07-26 21:13:25 +03:00
Ivan Kochurkin 59257e47c9 [FIR] Implement FUNCTION_CALL_EXPECTED 2021-06-29 22:39:22 +03:00
Denis.Zharkov 7645663d12 Deprecate (V)::a reference resolution to companion in FE 1.0
^KT-45315 Fixed
2021-06-25 18:41:14 +03:00
Denis.Zharkov c8c558b575 FIR: Use Any? expect type to the argument list of ==
^KT-47409 Related
2021-06-24 12:17:46 +03:00
Denis.Zharkov 0aca3a3737 FIR: Adjust test data after introduction of INFERENCE_NO_INFORMATION_FOR_PARAMETER
See previous commits for details
2021-06-07 15:25:47 +03:00
Victor Petukhov 54b9f39b3a Update tests after rebase 2021-05-28 15:36:24 +03:00
Victor Petukhov 4a767c597e Don't report the same diagnsotics several times 2021-05-28 15:36:23 +03:00
Denis.Zharkov dac9d7b17a FIR: Mark a pack of tests (53) as FIR_IDENTICAL 2021-05-25 13:28:29 +03:00
Denis.Zharkov ddbdfafa79 Remove OI/NI attributes from test data 2021-05-25 13:28:27 +03:00
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00
Denis.Zharkov da3233c47d FIR: Update test data (NEW_INFERENCE_ERROR)
Though these diagnostics look correct (the calls or constraint
systems indeed contain errors), more precise diagnostic kinds should be
chosen later.
2021-05-20 17:24:36 +03:00