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
Nikolay Lunyak
1a9f63efeb
[FIR] Fix INSTANCE_ACCESS_BEFORE_SUPER_CALL
2021-09-24 16:50:51 +00:00
Pavel Kunyavskiy
fb875c484d
[K/N] Implement instantiating of annotation class
2021-09-23 06:59:34 +00:00
Nikolay Lunyak
ba8dc49a31
[FIX] Move backing field bytecodeListing tests to a separate folder
2021-09-17 15:29:35 +03:00
Tianyu Geng
765cad8448
FIR checker: substitute type parameters in dispatch receiver type
...
Consider the following code:
```
fun test(a: List<String>) {
a.first()
}
```
The dispatch receiver type of `first` in this case is `List<T>` before
this change. After this change, it's `List<String>`.
In addition, this change also replace the dispatch receiver type with
the more specific type if available. For example, consider the following
```
class MyList: ArrayList<String>()
fun test(a: MyList) {
a.get(0)
}
```
The dispatch receiver type of `get` is `MyList`, instead of
`ArrayList<String>`. That is, a fake override is created in this case.
2021-09-17 01:59:06 +03:00
Tianyu Geng
d3e8cc577c
FIR checker: fix local type approximation on delegated property
...
Previously types of delegated property is not approximated, which can
cause local types to leak through public APIs.
2021-09-16 22:38:08 +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
Tianyu Geng
dfc36ec614
FIR checker: ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_(ANNOTATION|FUNCTION)
2021-09-15 12:11:41 +03:00
Tianyu Geng
e95de0a778
FIR checker: report type mismatch for named vararg arguement
...
ProhibitAssigningSingleElementsToVarargsInNamedForm is enabled from 1.3
so there is no need to make FIR accepting single element passed through
named arguments.
In addition, we may want to report only
ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_FUNCTION and not arg
type mismatch. But FE1.0 is reporting both so I am following it. If we
want to remove the redundant report, we will probably want to remove
FirNamedVarargChecker and report during resolution as a cone diagnostic.
2021-09-15 12:11:36 +03:00
Tianyu Geng
3708290ca3
FIR checker: fix NON_VARARG_SPREAD
2021-09-15 12:11:35 +03:00
Tianyu Geng
b8b9502db4
FIR checker: fix ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_ANNOTATION
...
Currently this checker is missing `arrayOf` calls inside annotation.
2021-09-15 12:11:28 +03:00
Tianyu Geng
3c84fbcab1
IR: make calls with explicit singleton receiver tailrec [KT-48602]
2021-09-14 23:48:52 +03:00
Tianyu Geng
8525b4932b
FIR Checker: check tailrec
...
Difference from FE1.0
* KT-4285: calls to virtual method with default argument should be
reported as not tailrec. FE1.0 is missing such cases.
* KT-48600: calls inside lambda should be reported as not tailrec. FE1.0
also misses such cases.
2021-09-14 23:48:50 +03:00
Denis.Zharkov
ef684c0dff
FIR: Improve error reporting for EXPRESSION_EXPECTED_PACKAGE_FOUND
2021-09-14 19:13:47 +03:00
Denis.Zharkov
6e6be7c953
FIR: Adjust test data
...
Currently, we've got two places where NO_COMPANION_OBJECT is reported
and they perform it kind of differently
2021-09-14 19:13:40 +03:00
Denis.Zharkov
9ca96ebbd2
FIR: Add FirVisibilityQualifierChecker
2021-09-14 19:13:39 +03:00
Denis.Zharkov
9575d4d242
FIR: Rework qualifier-in-expression resolution
...
Get rid of stateful FirQualifiedNameResolver
Resolve a.b.c-like calls step-by-step using just recursion
^KT-48363 Fixed
2021-09-14 19:13:38 +03:00
Ivan Kochurkin
a816bd9a33
[FIR] Add JVM_INLINE_WITHOUT_VALUE_CLASS, VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION
2021-09-13 20:49:00 +03:00
Ivan Kochurkin
7e7066d75e
[FIR] Add FUNCTION_DELEGATE_MEMBER_NAME_CLASH
2021-09-13 20:48:59 +03:00
Ivan Kochurkin
a5caa14255
[FIR] Add SPREAD_ON_SIGNATURE_POLYMORPHIC_CALL
2021-09-13 20:48:59 +03:00
Ivan Kochurkin
5760a94ab4
[FIR] Add CONCURRENT_HASH_MAP_CONTAINS_OPERATOR
2021-09-13 20:48:58 +03:00
Ivan Kochurkin
0ffd6ccb34
[FIR] Add SUSPENSION_POINT_INSIDE_CRITICAL_SECTION
2021-09-13 20:48:57 +03:00
Ivan Kochurkin
e97933a9e5
[FIR] Add POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION
2021-09-13 20:48:55 +03:00
Ivan Kochurkin
dd46c36b24
[FIR] Add SUBCLASS_CANT_CALL_COMPANION_PROTECTED_NON_STATIC
2021-09-13 20:48:54 +03:00
Ivan Kochurkin
07edb15138
[FIR] Expand typealias for correct approximation of types (particularly Int and Long)
2021-09-13 14:28:26 +00:00
Dmitriy Novozhilov
5769d42248
[FIR] Fix all usages of annotations due to new FirAnnotation hierarchy
2021-09-13 13:53:12 +03:00
Dmitriy Novozhilov
7a7672b0de
[FE 1.0] Fix reporting of non exhaustive when statement for whens with subject
...
^KT-48653 Fixed
2021-09-12 16:04:18 +03:00
Nikolay Lunyak
f6ae6af741
[FIR] Add test data
2021-09-11 22:05:43 +03:00
Mikhail Glukhikh
fc6403679a
Rename !USE_EXPERIMENTAL test directive to !OPT_IN
2021-09-10 16:29:16 +03:00
Mikhail Glukhikh
3febabe977
Use OPT_IN instead of EXPERIMENTAL in diagnostic names
2021-09-10 16:29:13 +03:00
Tianyu Geng
05fbed68e2
FIR checker: report PROPERTY_AS_OPERATOR
2021-09-10 07:07:43 +03:00
Tianyu Geng
4915d8dda3
FIR checker: support DUPLICATE_LABEL_IN_WHEN
...
Changes from FE1.0:
1. As discussed previously, no expression evaluation happens during this
check.
2. FE1.0 doesn't check redundant object comparisons.
2021-09-10 07:07:42 +03:00
Ivan Kochurkin
55f33999f1
[FIR] Add REPEATED_ANNOTATION, REPEATED_ANNOTATION_WARNING
2021-09-10 00:49:07 +03:00
Ivan Kochurkin
fa12e72551
[FIR] Add REPEATABLE_CONTAINER_* diagnostics
...
REPEATABLE_CONTAINER_MUST_HAVE_VALUE_ARRAY
REPEATABLE_CONTAINER_HAS_NON_DEFAULT_PARAMETER
REPEATABLE_CONTAINER_HAS_SHORTER_RETENTION
REPEATABLE_CONTAINER_TARGET_SET_NOT_A_SUBSET
REPEATABLE_ANNOTATION_HAS_NESTED_CLASS_NAMED_CONTAINER
2021-09-10 00:49:07 +03:00
Ivan Kochurkin
6fa1c0353c
Use deprecation type for some REPEATABLE_* diagnostics
2021-09-10 00:49:06 +03:00
Ivan Kochurkin
f414a91c66
[FIR] Implement FirInterfaceDefaultMethodCallChecker
...
Add diagnostics: INTERFACE_STATIC_METHOD_CALL_FROM_JAVA6_TARGET,
INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER,
DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET
2021-09-10 00:49:04 +03:00
Ivan Kochurkin
97bc079634
[FIR] Add REPEATED_ANNOTATION_WITH_CONTAINER, NON_SOURCE_REPEATED_ANNOTATION
...
REPEATED_ANNOTATION_TARGET6
2021-09-10 00:49:03 +03:00
Ivan Kochurkin
2baed77598
[FIR] Add JVM_SYNTHETIC_ON_DELEGATE diagnostic
...
Extract JVM names to common JvmNames
2021-09-10 00:49:03 +03:00
Ivan Kochurkin
3725c58794
[FIR] Add INAPPLICABLE_JVM_FIELD, INAPPLICABLE_JVM_FIELD_WARNING
2021-09-10 00:49:02 +03:00
Ivan Kochurkin
d4746903c8
[FIR] Rename getOuterClass to getContainingDeclaration, fix if for local classes
...
Simplify checking of WRONG_NUMBER_OF_TYPE_ARGUMENTS
2021-09-10 00:49:01 +03:00
Ivan Kochurkin
816e8f487c
[FIR] Add JVM diagnostics about external declaration
2021-09-10 00:49:00 +03:00
Ivan Kochurkin
cfd2835254
[FIR] Add JVM Default diagnostics
2021-09-10 00:48:59 +03:00
Nikolay Lunyak
1a3f47badd
[FIR] Make FirJvmStaticChecker more consistent with the legacy version
2021-09-09 20:18:49 +03:00
Nikolay Lunyak
2a2c92d8b3
[FIR] Add support for JVM_STATIC_ON_EXTERNAL_IN_INTERFACE diagnostic
2021-09-09 20:18:49 +03:00
Nikolay Lunyak
7006426304
[FIR] Add support for JVM_STATIC_ON_CONST_OR_JVM_FIELD diagnostic
2021-09-09 20:18:49 +03:00
Nikolay Lunyak
f3d61c199b
[FIR] Add support for JVM_STATIC_ON_NON_PUBLIC_MEMBER diagnostic
2021-09-09 20:18:49 +03:00
Nikolay Lunyak
c2e5583780
[FIR] Add support for JVM_STATIC_NOT_IN_OBJECT_OR_COMPANION diagnostic
2021-09-09 20:18:49 +03:00
Nikolay Lunyak
276bfd9305
[FIR] Add support for OVERRIDE_CANNOT_BE_STATIC diagnostic
2021-09-09 20:00:38 +03:00
Nikolay Lunyak
5607be3920
[FIR] Add support for INAPPLICABLE_JVM_NAME diagnostic
2021-09-09 20:00:36 +03:00
Nikolay Lunyak
5ebad97cd5
[FIR] Add support for ILLEGAL_JVM_NAME diagnostic
2021-09-09 19:58:16 +03:00