Commit Graph

2599 Commits

Author SHA1 Message Date
Andrey Zinovyev c2389a94fa [FIR] Resolve annotations in when expressions 2021-05-27 12:41:16 +03:00
Ivan Kochurkin cf531dbbe6 [FIR] Implement TYPE_VARIANCE_CONFLICT, TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE diagnostics, fix tests 2021-05-25 00:07:33 +03:00
Ilya Kirillov be4632c2fe FIR: add missing ArgumentTypeMismatch.isMismatchDueToNullability after rebase 2021-05-20 21:05:41 +02:00
Tianyu Geng e1b542314a FIR IDE: quickfix for WrapWithSafeLetCall
There is some behavior change regarding the new WrapWithSafeLetCall quickfix

1. it now works correctly on binary expressions by wrapping it with `()`
2. it now looks for a nullable position upward and do the modification there,
   if possible. For example, consider the following code

   ```
   fun bar(s: String): String = s

   fun test(s: String?) {
     bar(bar(bar(<caret>s)))
   }
   ```

   After applying this fix, FE1.0 yields

   ```
   bar(bar(s?.let { bar(it) }))
   ```

   while the new implementation yields

   ```
   s?.let { bar(bar(bar(it))) }
   ```

   This behavior aligns with FE1.0 if `bar` accepts nullable values.
2021-05-20 20:33:00 +02:00
Tianyu Geng 9106ae4f5f FIR: store in ARGUMENT_TYPE_MISMATCH whether it's due to nullability 2021-05-20 20:32:59 +02:00
Denis.Zharkov db500fab94 FIR: Avoid reporting redundant TYPE_MISMATCH (for assignments) 2021-05-20 17:24:50 +03:00
Denis.Zharkov c3646b11ac FIR: Fix inference when unit value should be cast to Any 2021-05-20 17:24:44 +03:00
Denis.Zharkov faa5e46396 FIR: Fix inference case with flexible captured types
Previsously, errors have been ignored because we ignored errors raised
from the completion phase

See the comment above the createConstraintPartForLowerBoundAndFlexibleTypeVariable
2021-05-20 17:24:28 +03:00
Denis.Zharkov c46d049394 FIR: Implement more precise reporting diagnostics from new inference 2021-05-20 17:24:26 +03:00
Denis.Zharkov c67ae8a0a3 FIR: Replicate coercion-to-unit behavior from FE 1.0 2021-05-20 17:24:25 +03:00
Denis.Zharkov dac5c31993 Minor. Simplify ConstraintSystemUtilContext::createArgumentConstraintPosition 2021-05-20 17:24:23 +03:00
Denis.Zharkov 9c7982673b FIR: Support substitution of inner class constructor capturing outer type parameters 2021-05-20 17:24:22 +03:00
Denis.Zharkov 91806c0a68 FIR: Refine diagnostics in case argument type mismatch on lambda
Report ArgumentTypeMismatch instead of imprecise NEW_INFERENCE_ERROR
2021-05-20 17:24:21 +03:00
Denis.Zharkov 2b806e717d FIR: Avoid adding new constraints when system already has contradictions 2021-05-20 17:24:20 +03:00
Denis.Zharkov 571c16be52 FIR: Fix computing dispatch receiver for property-delegation operators 2021-05-20 17:24:19 +03:00
Denis.Zharkov 35c754c27c FIR-DFA: Ignore FinallyBlockExitNode when computing return arguments 2021-05-20 17:24:17 +03:00
Denis.Zharkov 42d387925d FIR: Refine makesSenseToBeDefinitelyNotNull
Make it work just the same as the analogue from FE 1.0
This change is necessary since many tests start failing after
we began reporting diagnostics after call completion
2021-05-20 17:24:12 +03:00
Denis.Zharkov a700fdc312 FIR: Report diagnostics introduced during call completion 2021-05-20 17:24:10 +03:00
Jinseong Jeon f0f1e2d945 FIR checker: report CAPTURED_VAL_INITIALIZATION 2021-05-20 13:59:13 +03:00
Andrey Zinovyev d38effcbbe Use camel-case in FirFunctionCallOrigin
Also componentCall is operator call
2021-05-20 13:46:35 +03:00
Andrey Zinovyev 07a8ae7e71 [FIR] Mark more calls origin as OPERATOR 2021-05-20 13:46:32 +03:00
Andrey Zinovyev 0a45b3a50b [FIR] Set Function call origin to assign operators' functions 2021-05-20 13:46:31 +03:00
Andrey Zinovyev e021e25d6c [FIR] Resolve operator calls to operator functions only 2021-05-20 13:46:29 +03:00
Andrey Zinovyev b1c8669b43 [FIR] Resolve infix calls to infix functions only
Implements INFIX_MODIFIER_REQUIRED diagnostics
2021-05-20 13:46:27 +03:00
Mikhail Glukhikh 9a13ec9b76 FIR: report WRONG_ANNOTATION_TARGET on types 2021-05-20 12:22:22 +03:00
Mikhail Glukhikh f0ce311fc6 Drop unused ConeTypeMismatchError 2021-05-20 12:22:19 +03:00
pyos bfb1a06f3d FIR: resolve conflicts between overloads with platform integer types 2021-05-18 22:11:33 +03:00
Victor Petukhov 2239404085 Extract type preparation during type checking to a separate component 2021-05-18 17:52:23 +03:00
Ivan Kochurkin c3b8f3e859 [FIR] Add lValueTypeRef to FirVariableAssignment, fix tests with ASSIGNMENT_TYPE_MISMATCH 2021-05-17 22:33:18 +03:00
Igor Yakovlev 633e03b710 [FIR IDE] LowLevel api refactoring 2021-05-14 23:05:54 +03:00
Igor Yakovlev 445f13d1bf [FIR IDE] Fix invalid body lazy resolve 2021-05-14 23:05:53 +03:00
Igor Yakovlev 37ccab4e23 [FIR] Fixed supertypes resolve for invalid code with class without ClassId 2021-05-14 23:05:48 +03:00
Igor Yakovlev 2e7eedd3f2 [FIR IDE] Correct in-body supertype resolve of fake nodes 2021-05-14 23:05:46 +03:00
Igor Yakovlev 959ff50fa7 [FIR IDE] Collect tower contexts for local declarations 2021-05-14 23:05:45 +03:00
Igor Yakovlev ae63ad0b6d [FIR] Fix annotations invalid references diagnostics 2021-05-14 23:05:44 +03:00
Igor Yakovlev 779a06e86f [FIR IDE] Add types, supertypes and status lazy designated transformers 2021-05-14 23:05:41 +03:00
Dmitriy Novozhilov 02c58b7a8f [FIR] Refactor deserialized dependency providers and session factories with FirModuleData 2021-05-14 14:30:33 +03:00
Dmitriy Novozhilov 24f1f7b7b2 [FIR] Unify FirLibrarySession and FirJavaModuleBasedSession into single FirCliSession 2021-05-14 14:30:32 +03:00
Dmitriy Novozhilov f16194e60d [FIR] Get rid of FirSession.moduleInfo 2021-05-14 14:30:31 +03:00
Dmitriy Novozhilov 5cfa8694d4 [FIR] Fix all usages of declarationSiteSession 2021-05-14 14:30:27 +03:00
Dmitriy Novozhilov e8c4b0e947 [FIR] Rename KotlinScopeProvider to FirKotlinScopeProvider 2021-05-14 14:30:22 +03:00
Dmitriy Novozhilov d114913cd2 Replace usages of addToStdlib.firstNotNullResult with firstNotNullOfOrNull 2021-05-14 14:30:19 +03:00
Tianyu Geng 3c4e3e8db6 FIR: remove obsolete DataFlowVariablev.isStable 2021-05-14 13:34:33 +03:00
Mikhail Glukhikh 632a9d66d1 FIR: introduce isPrimitive / isPrimitiveOrNullablePrimitive helpers 2021-05-13 16:13:42 +03:00
Dmitriy Novozhilov 1a3b5657c7 [FIR] Fix overload conflicts resolution for callable references with defaults 2021-05-13 15:31:18 +03:00
Alexander Udalov 54befa769f IR: add IrClass.getInlineClassRepresentation, serialize/deserialize it
The change in FirDeclarationUtil is needed because in case of unsigned
types loaded from the standard library, the primary constructor for some
reason is not the first, but the second in the list of constructors.
2021-05-13 13:56:59 +02:00
Ivan Kochurkin 598501aaf0 [FIR] Improve locations for DEPRECATED_SINCE_KOTLIN_WITHOUT_DEPRECATED, DEPRECATED_SINCE_KOTLIN_WITH_DEPRECATED_LEVEL, DEPRECATED_SINCE_KOTLIN_OUTSIDE_KOTLIN_SUBPACKAGE and other diagnostics, refactor 2021-05-12 18:42:44 +03:00
Ivan Kochurkin 3191e0b925 [FIR] Implement DEPRECATED_SINCE_KOTLIN_WITHOUT_ARGUMENTS diagnostics, fix tests, merge and refactor annotation checkers 2021-05-12 18:42:40 +03:00
Ivan Kochurkin dc99a673a5 [FIR] Implement DEPRECATED_SINCE_KOTLIN_WITH_UNORDERED_VERSIONS diagnostics, fix tests 2021-05-12 18:42:38 +03:00
Jinseong Jeon 8e10b5fdec FIR: introduce FirExpressionWithSmartcastToNull
This new kind of expression encompasses the nullability of the original
expression after null check (or equivalent `is Nothing?` check).

Unlike FirExpressionWithSmartcast, this expression won't be materialized
during conversion to backend IR. Also, Nothing? is discarded when
computing the intersection of possible types from smartcast info.
In that way, Nothing? is not used during resolution, while such
smartcast info is stored in it (and the expression kind itself).
2021-05-11 21:28:44 +03:00