Commit Graph

299 Commits

Author SHA1 Message Date
Jinseong Jeon e009b71f88 FIR checker: report uninitialized member/extension properties 2021-03-04 17:56:29 +03:00
Jinseong Jeon f1fa290d49 FIR checker: report val reassignment 2021-03-03 12:27:11 +03:00
Dmitriy Novozhilov 469252f6b4 [FIR] Don't create smartcast node if smartcasted type is equal to original type 2021-02-20 10:23:33 +03:00
Mikhail Glukhikh 34c90aab3b FIR: introduce & use REFERENCE_BY_QUALIFIER positioning strategy 2021-02-19 18:24:46 +03:00
Mikhail Glukhikh 04caa5c612 Fix DEBUG_INFO_CALL positioning in FIR 2021-02-19 18:24:45 +03:00
Mikhail Glukhikh 357a7907a3 FIR: fix type approximation by visibility 2021-02-19 10:39:57 +03:00
Dmitriy Novozhilov 373bc578fb [FIR] Implement capturing of cone types same as for kotlin types 2021-02-17 16:23:08 +03:00
Dmitriy Novozhilov 2b39282682 [FIR] Render original type before smartcasted type in DEBUG_INFO_EXPRESSION_TYPE
This is made for keep consistency with same renderer in FE 1.0
2021-02-16 17:51:32 +03:00
Dmitriy Novozhilov d4c26cca52 [FIR] Use type without smartcast for local variable with smartcasted initializer 2021-02-16 17:51:32 +03:00
pyos 2dc0404751 FIR: prioritize visible imported classes during type resolution
and produce an error on ambiguity.
2021-02-16 12:38:45 +03:00
Jinseong Jeon 09640d9d63 FIR checker: apply override checker to anonymous objects
^KT-44695 Fixed
2021-02-15 19:16:35 +03:00
Dmitriy Novozhilov 5711a8d610 [FIR] Support PreliminaryLoopVisitor in FIR DFA 2021-02-15 11:37:39 +03:00
Jinseong Jeon 20f9787c70 FIR checker: report errors in contract description 2021-02-11 17:02:18 +03:00
Jinseong Jeon 3d635b6a94 FIR: unwrap smartcast expression when extracting effects of contract 2021-02-11 17:02:16 +03:00
Jinseong Jeon 5e150d62ea FIR checker: differentiate UNSAFE_IMPLICIT_INVOKE_CALL from UNSAFE_CALL 2021-02-10 17:38:44 +03:00
Dmitriy Novozhilov d7e3e83251 [FIR] Update testdata of FIR spec tests 2021-02-09 16:04:41 +03:00
Jinseong Jeon 266432a482 FIR checker: fix condition for property type mismatch on override 2021-02-08 13:01:11 +03:00
Jinseong Jeon 3a07ca4c64 FIR checker: add diagnostic VAR_OVERRIDDEN_BY_VAL 2021-02-03 12:07:36 +03:00
Jinseong Jeon b48835f3ce FIR checker: fix positions of type mismatch on overrides
To handle implicit return types, those should be reported on
declarations with return type positioning strategy, instead of
return type itself.
2021-02-03 12:07:35 +03:00
Mikhail Glukhikh 7d4eaefd36 FIR: report UNSAFE_CALL on dot when possible 2021-01-29 16:55:26 +03:00
Mikhail Glukhikh 0ee4f1f393 FIR: more exact nullability determination in potential UNSAFE_CALL check 2021-01-29 16:55:09 +03:00
Jinseong Jeon e72ddbcbfe FIR checker: differentiate UNSAFE_CALL from INAPPLICABLE_CANDIDATE
To do so, inside the root cause of inapplicable candidate errors,
we will record expected/actual type of receiver, if any.
That will help identifying inapplicable calls on nullable receiver.
2021-01-29 16:54:23 +03:00
Dmitriy Novozhilov 9b80a552e9 [Test] Update testdata of spec tests 2021-01-28 13:19:25 +03:00
Dmitriy Novozhilov ca3bb02897 [TD] Update spec testdata after f06a5321 2021-01-25 17:16:54 +03:00
Dmitriy Novozhilov 663d5026d8 [Test] Migrate FIR diagnostic spec tests to new infrastructure
This commit includes a lot of minor changes in testdata: new infrastructure
  requires that each test file in one testdata file in one module must
  have unique name, but a lot of existing spec tests didn't satisfy
  this requirement
2021-01-25 17:08:32 +03:00
Victor Petukhov f06a5321a6 Approximate definitely not-null types for type parameter's types if they are already not-null (has not-null upper bounds)
^KT-44440 Fixed
2021-01-25 14:17:58 +03:00
Mikhail Glukhikh 06ee768c6a FIR: in case of smart cast, use original type for FirThisRcvrExpression
Before this commit, we used type after smart cast both for original
FirThisReceiverExpression and for wrapping FirExpressionWithSmartCast.
However, this makes FIR2IR implicit cast generator work incorrectly
(it decides not to insert implicit cast because original type is the same).
After this commit, expressions have different types and implicit cast
generator works properly.
2021-01-23 10:56:34 +03:00
Jinseong Jeon 39df3e2b0a FIR checker: introduce member function checker 2021-01-15 14:38:35 +03:00
Mikhail Glukhikh 0c0dbd6245 [FIR] Perform more accurate pre-check of candidate receiver type 2021-01-11 17:57:04 +03:00
Victor Petukhov b4d8adeeb4 Don't clean type info for containment operator if the resolution was unsuccessful, but all diagnostics were about only input types and non-strict only input types check was enabled 2020-12-25 11:53:09 +03:00
Jinseong Jeon cdfe1771d9 FIR DFA: reimplement type OR operation to its original semantics
#KT-43569 Fixed
2020-12-07 10:50:19 +03:00
Jinseong Jeon 5167d69b7c FIR checker: introduce member property checker 2020-12-04 16:58:30 +03:00
Mikhail Glukhikh 52a07e31c7 [FIR] Remove D_I_EXPRESSION_TYPE from qualified calls in spec test data
In FIR, the source of FirFunctionCall is set to call's selector.
In practice, sometimes (e.g. for DEBUG_INFO_CALL)
we expect the selector as the source,
and sometimes (e.g. for DEBUG_INFO_EXPRESSION_TYPE)
we expect the whole qualified call as the source.
Also, some diagnostics, like REDUNDANT_CALL_OF_CONVERSION_METHOD,
are expected to be reported on a selector, not on a whole call.
At this moment we ignore the problem & just don't support
DEBUG_INFO_EXPRESSION_TYPE for qualified calls.
2020-11-26 08:37:48 +03:00
Mikhail Glukhikh 82c5cefba9 Update test data in FIR diagnostic spec tests 2020-11-26 08:37:48 +03:00
Denis Zharkov 14305d1eba FIR: Simplify callable references resolution
Also that fixes some bugs
2020-11-16 15:50:39 +03:00
Denis Zharkov d4c7d4fc7c FIR: Fix callable references resolution with stub receivers
Use stubReceiver as a receiver for fake calls

See issues KT-43358 KT-43359 KT-43378
2020-11-16 15:50:39 +03:00
Denis Zharkov f97cc0b62d FIR: Rework receivers processing in resolution
- Put extensionReceiver to candidate even if it's explicit (for sake of clarity)
- Split CheckReceiver (dispatch part should only check nullability)
2020-11-16 15:50:39 +03:00
Dmitriy Novozhilov 87380d1913 [FIR] Don't assume that exit lambda node is target for exceptional exit for inplace lambdas
#KT-39709 Fixed
#KT-43156 Fixed
2020-11-12 14:46:38 +03:00
Denis Zharkov a5545b96cb FIR: Fix ambiguity between current Companion and one from supertypes
Companion as qualifier should be found at static scope not a member one
2020-11-10 14:26:54 +03:00
Jinseong Jeon b3b09ea9b7 FIR: adjust spec testData after DFA changes:
* recording type statements for null assignments
* element-wise join by default
2020-11-04 16:35:42 +03:00
Mikhail Glukhikh 7b4f781ea8 [FIR] Split primary constructor parameter scope into two different
In init block or property initializers,
for `val x` declared in primary constructor,
`x` reference is now resolved to property, not to parameter.
So we need two different scopes for primary constructor,
one for 'pure' parameters and another one for all parameters,
including val/var ones.

#KT-42844 Fixed
2020-10-30 18:44:55 +03:00
Mikhail Glukhikh abc2866902 [FIR] Fold flexible types after substitution if possible 2020-10-23 08:12:16 +03:00
Victor Petukhov 84129098cb Add equality constraints without subtyping
^KT-42195 Fixed
^KT-41741 Fixed
2020-10-21 21:23:13 +03:00
Dmitriy Novozhilov bf1a00c73a [FIR] Rework resolution of declaration statuses
There is introduced algorithm of resolution with jumps: before
  resolution of some class we resolve all status of members of its
  supertypes, so we can properly determine inherited visibility
  and modifiers
2020-10-21 11:53:10 +03:00
Jinseong Jeon ed188204b4 FIR checker: make property init analyzer path-sensitive
In particular, exception throwing path after finally block is
distinguished via path label.

KT-42350 Fixed
2020-10-15 14:22:39 +03:00
Pavel Kirpichenkov ef44077cb7 [FIR] Restore variable fixation direction in call completion
Several tests are affected by the usage of fixation direction calculator in FIR.
Restored to mimimize test data changes.

It is unnecessary in FE10 because a type variable with unknown type
is inferred into an error type, but affects test data in FIR where
Nothing/Any is selected by direction (as a temporary measure).

CR candidate in spec test is Unresolved in FIR because top-level CRs are resolved as call arguments.
Resolution ambiguity is also present in FE10 when CR is wrapped into an id call.
2020-10-13 11:00:21 +03:00
Ilmir Usmanov 3b5706972e Extract effect from lambda argument if it is in parentheses
Otherwise, contracts on the parameter have no effect.
 #KT-42044 Fixed
 #KT-26229 Fixed
2020-10-12 20:16:19 +02:00
anastasiia.spaseeva 31de584d14 [Spec tests] Generate sections json map 2020-10-01 12:32:22 +03:00
Victor Petukhov d02432cf93 Introduce warning for the changing arguments execution order for named varargs (KT-17691) 2020-10-01 12:15:13 +03:00
Dmitriy Novozhilov 5efd533f55 [FIR] Desugar unary plus and minus as part of integer literal
#KT-42016
2020-09-23 14:05:09 +03:00