Commit Graph

179 Commits

Author SHA1 Message Date
Ivan Kochurkin 744191099c [FIR] Fix false positive "return required" for if/else with inlined return in branch
^KT-49289 Fixed
2021-10-28 20:02:25 +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
Victor Petukhov 561ef5947a Introduce error for PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE
^KT-42972 Fixed
2021-09-30 20:08:37 +03:00
Victor Petukhov 01e853fb9b Introduce error for SUPER_CALL_FROM_PUBLIC_INLINE
^KT-45378 Fixed
2021-09-30 20:08:36 +03:00
Mark Punzalan 42abc4a3af FIR: Don't use AnnotationUseSiteTarget.PROPERTY_GETTER when computing
deprecation from a callable reference use site.

Also fixed positioning of DEPRECATION(_ERROR) diagnostics on variable
assignments.
2021-09-29 19:39:17 +03:00
Tianyu Geng 76e192fc8a FIR Checker: check AMBIGUOUS_ANONYMOUS_TYPE_INFERRED
Also change
org.jetbrains.kotlin.fir.types.TypeUtilsKt#hideLocalTypeIfNeeded to skip
approximating anonymous objects if there are multiple super type refs so
that resolution behaves the same (for uncompilable code).

Note that this change does not implement check for
ApproximateAnonymousReturnTypesInPrivateInlineFunctions as the check is
already turned on in 1.5 and will likely not needed when FIR becomes
stable.
2021-09-16 22:38:06 +03:00
Andrey Zinovyev 1cd321a90f [FIR] Add INAPPLICABLE_OPERATOR_MODIFIER diagnostic 2021-08-18 16:03:01 +03:00
Andrey Zinovyev dabc983f6a [FIR] Add INVALID_DEFAULT_FUNCTIONAL_PARAMETER_FOR_INLINE diagnostic 2021-08-04 17:33:13 +03:00
Andrey Zinovyev 46d1b63f70 [FIR] Add INLINE_PROPERTY_WITH_BACKING_FIELD diagnostic 2021-08-04 17:33:11 +03:00
Andrey Zinovyev 38cecf8b12 [FIR] Add REIFIED_TYPE_PARAMETER_IN_OVERRIDE diagnostic 2021-08-04 17:33:10 +03:00
Andrey Zinovyev 29dbaa4ae1 [FIR] Add OVERRIDE_BY_INLINE diagnostic 2021-08-04 17:33:10 +03:00
Andrey Zinovyev d8b7b7b2dc [FIR] Add DECLARATION_CANT_BE_INLINED diagnostic 2021-08-04 17:33:09 +03:00
Andrey Zinovyev 4e06814bc5 [FIR] Add NULLABLE_INLINE_PARAMETER diagnostic 2021-08-04 17:33:08 +03:00
Andrey Zinovyev 015c2d1875 [FIR] Add NOTHING_TO_INLINE diagnostic 2021-08-04 17:33:08 +03:00
Andrey Zinovyev 28344c8530 [FIR] Add NOT_YET_SUPPORTED_IN_INLINE diagnostic 2021-08-04 17:33:07 +03:00
Dmitriy Novozhilov d17f984edf [FE 1.0] Migrate most of warning/error pairs to DiagnosticFactoryForDeprecation 2021-08-03 00:17:33 +03:00
Dmitriy Novozhilov 0ab4770f02 [FIR] Add correctly reported diagnostics to testdata 2021-07-02 15:55:05 +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
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 3663884db2 FIR: support CONDITION_TYPE_MISMATCH diagnostic
We report CONDITION_TYPE_MISMATCH on
- loop conditions
- when branch conditions
- binary logic arguments
2021-05-20 12:22:20 +03:00
Jinseong Jeon e2dc21da90 FIR checker: warn useless as and is 2021-05-05 18:20:51 +03:00
Dmitriy Novozhilov 07b15f9de6 [FIR] Support effective visibility with @PublishedApi
#KT-46270 Fixed
2021-04-27 18:39:10 +03:00
Dmitriy Novozhilov 32c3f85679 [FIR] Add inline checker for bodies of inline functions
This checker doesn't support `@PublishedAPI` yet, so some BB tests for it
 were muted. #KT-46270
2021-04-27 18:39:09 +03:00
Dmitriy Novozhilov 3cb17ac2f0 [FIR] Implement FirReturnAllowedChecker
Supported diagnostics:
- RETURN_NOT_ALLOWED
- RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY
2021-04-06 12:30:41 +03:00
Dmitriy Novozhilov cd890d5833 [Test] Disable UNUSED_* diagnostics in tests which are not belong to contolFlowAnalysis suite 2021-03-29 16:12:29 +03:00
Tianyu Geng fb14b03824 FIR checker: skip error named reference if receiver is unresolved
Currently, FIR reports errors caused by previous resolution failure. For
example with unresolved `a` and `b` in code `a.b`, both `a` and `b` are
highlighted. FE1.0 only highlights `a` since it's the root cause. This
change applies this heuristics when reporting FirDiagnostics.
2021-03-29 12:45:27 +03:00
Mikhael Bogdanov 8ff0b1e243 Reports warning on super calls in public-api inline functions 2021-03-05 18:45:07 +00:00
Tianyu Geng 724ca1d3ee FIR: introduce diagnostic NESTED_CLASS_NOT_ALLOWED 2021-03-01 16:57:54 +03:00
Mikhail Glukhikh 357a7907a3 FIR: fix type approximation by visibility 2021-02-19 10:39:57 +03:00
Victor Petukhov ba44ad1aa3 Approximate anonymous return types for private inline functions to explicit supertype or Any (KT-33917) 2021-01-28 13:19:32 +03:00
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00
Mikhael Bogdanov 21521aa397 Deprecate protected constructors call from public inline function
#KT-21177
2020-10-27 14:51:08 +01:00
Victor Petukhov 09f1764f82 Introduce warning for private inline functions which return anonymous objects without specified supertypes (KT-33917) 2020-09-29 10:23:45 +03:00
Nick 4669e019d1 [FIR] Add diagnostic CONFLICTING_OVERLOADS & REDECLARATION 2020-08-10 10:09:37 +03:00
Nick 26e3a111d6 [FIR] Add diagnostics for object related problems 2020-07-31 19:34:55 +03:00
Dmitriy Novozhilov 309050d956 [FIR] Add ExtensionFunctionType attribute
#KT-39034 Fixed
2020-06-30 11:30:19 +03:00
Denis Zharkov fa3b3e7a9a FIR: Fix false positive INAPPLICABLE_INFIX_MODIFIER 2020-04-21 09:48:03 +03:00
rapturemain 6d63de01ac [FIR] Fix effective visibility calculation & relevant test data 2020-04-20 17:25:26 +03:00
Mikhail Glukhikh 8884cbe415 Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed 2020-03-05 09:39:40 +03:00
Ilya Chernikov 6356807997 Reapply "Only create descriptors for candidates with lambda args"
#KT-36247 fixed
A lot of testdata changed because significanly less (error) descriptors
are created for unresolved types, so diagnostics became different.
2020-02-14 11:41:30 +01:00
Mikhail Glukhikh 64c7ab1302 [FIR] Fix lambda resolve in independent context 2020-02-04 15:00:12 +03:00
simon.ogorodnik 5e426fdc71 [FIR] Optimization & checking fix: remove usage of dispatchReceiverValue 2019-12-27 13:45:59 +03:00
Mikhail Glukhikh de50f8aef3 FIR resolve: add partial support of extension lambda calls
Here we introduce ONLY_IMPLICIT_RECEIVER tower level
to support extension lambda calls on local variables,
and soften extension receiver checks to make such extensions visible & applicable.
Also here we try to map arguments twice for functional types
2019-12-27 09:57:36 +03:00
Dmitriy Novozhilov 2536fa0cd5 [FIR-TEST] Add new testdata generated after changes in previous commit 2019-12-12 16:11:46 +03:00
Pavel Kirpichenkov d9ef7d0c8a [NI] Update / mute diagnostics
Update diagnostics for new inference.
'Not enough information for parameter' should not be reported for
fake calls and functions with error return type, muted in tests.
2019-12-11 17:53:43 +03:00
Mikhael Bogdanov df96841c9d Prohibit protected method calls from inline function
#KT-21178 Fixed
2019-12-02 08:04:26 +01:00
Mikhail Zarechenskiy bcc8802014 [NI] Avoid constraints from expected type for effectively empty system
Expression will be checked against expected type later.

 Theoretically, this is not very good, but it aligns with the old
 inference, plus it helps avoiding multiple type mismatch diagnostics.
2019-04-17 12:55:12 +03:00