Commit Graph

682 Commits

Author SHA1 Message Date
Ivan Kochurkin f046f2964b [FIR] Add PLATFORM_CLASS_MAPPED_TO_KOTLIN 2021-11-24 23:13:41 +03:00
Nikolay Lunyak 8d647fa016 [FIR] KT-49265: Fix implicit visibility checks 2021-11-24 14:44:50 +03:00
Ilya Kirillov 8ace9e45b9 LL API: unmute passing test 2021-11-23 15:41:03 +03:00
Dmitriy Novozhilov 9c7058c3c5 [FIR] Support fields as part of graph of class initialization
^KT-49747 Fixed
2021-11-22 20:22:22 +03:00
Dmitriy Novozhilov 9807c67ae4 [FIR] Properly collect overriddens for method enhancement
If some java class has multiple supertypes then we need to collect
  overriddens from all those types directly, even if superTypeScope
  (which is FirTypeIntersectionScope in this case) returns only
  one symbol from one of this types (not intersection one)

This is needed to proper enhancement in cases when some type occurs
  multiple times in supertypes graph with different nullability
  of arguments:

class ConcurrentHashMap<K, V> : AbstractMap<K!, V!>, MutableMap<K, V>

If we try to find method `get(key: K): V` supertype scope returns
  `AbstractMap.get(key: K!): V!` (because it actually overrides
  `MutableMap(key: K): V?`), but we need to get both symbols to
  properly enhance types for `ConcurrentHashMap.remove`
2021-11-22 17:01:17 +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
Dmitriy Novozhilov 2aa027639c [FIR] Fix access to fields from super class
^KT-49654 Fixed
2021-11-16 15:48:08 +03:00
Dmitriy Novozhilov 499b97d51e [FIR] Fix setting file in supertypes resolution
^KT-49652 Fixed
2021-11-16 15:48:06 +03:00
Ilmir Usmanov b7d88be41a Regenerate FIR diagnostics-related files 2021-11-13 12:38:49 +01:00
zhelenskiy c1dc1f7e33 Diagnostics renamed
Signed-off-by: zhelenskiy <zhelenskiy2000@yandex.ru>
2021-11-13 12:38:45 +01:00
Ivan Kochurkin 98cce8e05b [FIR] Support of intersection types in bareTypes.doUnify ^KT-48832 Fixed 2021-11-12 15:20:47 +03:00
Ivan Kochurkin d0a4ca199d [FIR] Add UNCHECKED_CAST
Regenerate diagnostics code
2021-11-12 15:20:45 +03:00
Ivan Kochurkin 2b5524b18f [FIR] Add CAST_NEVER_SUCCEEDS 2021-11-12 15:20:44 +03:00
Ivan Kochurkin e52a410599 [FIR] Initialize outer type parameters for local classes 2021-11-12 15:20:42 +03:00
Mikhail Glukhikh b2d020606e FIR: don't generate extension callable reference without receiver 2021-11-12 12:53:29 +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
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
Denis.Zharkov 507422d3d8 FIR: Fix bare type case with flexible supertypes 2021-10-26 18:45:58 +03:00
Mikhail Glukhikh 1fe7a1ebb3 Add FIR test for KT-35565 2021-10-26 13:38:35 +03:00
Denis.Zharkov a0a57581ec FIR: Do not add alias for variables with explicit type 2021-10-20 22:05:24 +03:00
Mikhail Glukhikh 7fc19520a5 FIR: substitute super type during tower building properly #KT-49301 Fixed 2021-10-20 12:17:04 +03:00
Mikhail Glukhikh b76e61cbc5 FIR: set dispatch receiver type to constructor in deserialization 2021-10-20 12:17:03 +03:00
Mark Punzalan 167dc81d3b FIR/Analysis API: Get parameter name from function type notation or
`@ParameterName` annotation, which is also now added during type
resolution.
2021-10-15 16:19:00 +03:00
Mikhail Glukhikh f4067f05a2 FIR: forbid java.lang.String(String) constructor in JvmMappedScope
#KT-49135 Fixed
2021-10-15 01:24:51 +03:00
Mikhail Glukhikh 09bc729b0e FirDefaultParametersResolver: process imported from objects properly
#KT-49083 Fixed
2021-10-15 01:24:51 +03:00
Mikhail Glukhikh c5a4a5de42 Make FirArrayOfCallTransformer recursive #KT-49076 Fixed 2021-10-15 01:24:49 +03:00
Mikhail Glukhikh 31db76da56 FIR: fix false positives of INNER_CLASS_OF_GENERIC_THROWABLE_SUBCLASS
#KT-49129 Fixed
2021-10-15 01:24:47 +03:00
Dmitriy Novozhilov c60ba51f8f [FIR] Include generated declarations into FIR dump in tests
Also include non root package directive of FirFile to dump
2021-10-12 17:26:34 +03:00
Mikhail Glukhikh 7243d30869 Split property use-site targets during FIR building 2021-10-12 16:22:58 +03:00
Mikhail Glukhikh 2a9a1dbb86 FIR: allow diagnostic collection on default property accessors 2021-10-12 16:22:56 +03:00
Mikhail Glukhikh 39fe457f91 Add test reproducing KT-49087 and KT-49069 2021-10-12 16:22:54 +03:00
Denis.Zharkov 9d9f191f51 FIR: Fix exception caused by empty supertypes of java.lang.Object 2021-10-07 17:26:25 +03:00
Nikolay Lunyak e5d5e5be44 [FIR] Reorder scopes for KT-34822 2021-10-05 19:37:53 +03:00
Roman Golyshev 9b9c51bc8d [FIR] Fix dispatch receivers on inner classes' constructors
1. Inner class constructor should have its outer class as a dispatch
receiver, since it is necessary for the call. Before it was null
2. Substituted inner class constructor should have its original dispatch
 receiver type with the proper substitution. Before it was set to the
 class itself (since the class was usually passed as a new dispatch
 receiver)

Also, modify FIR renderer, so it properly renders the dispatch receiver
of the constructors
2021-10-05 12:17:08 +00:00
Nikolay Lunyak 1363a49d30 [FIR] KT-44939: report REDUNDANT_VISIBILITY for explicit public overriding public 2021-09-30 09:09:19 +00:00
Nikolay Lunyak 9790b81f38 [FIR] Fix missing REDUNDANT_VISIBILITY_MODIFIER 2021-09-24 16:48:51 +00:00
Abduqodiri Qurbonzoda 261d0c2783 Promote collection builders to stable #KT-47421 2021-09-21 11:25:28 +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
Roman Golyshev bb2b0107c6 [FIR] Render backing fields by FirRenderer 2021-09-15 18:33:43 +00: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
Denis.Zharkov ef684c0dff FIR: Improve error reporting for EXPRESSION_EXPECTED_PACKAGE_FOUND 2021-09-14 19:13:47 +03:00
Denis.Zharkov 226893c648 FIR: Adjust test data to correct from FE 1.0 point-of-view behavior
^KT-38031 Related
2021-09-14 19:13:41 +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
Nikolay Lunyak 0181c80ddb [FIX] Add some more tests 2021-09-14 18:42:27 +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 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
Dmitriy Novozhilov 5769d42248 [FIR] Fix all usages of annotations due to new FirAnnotation hierarchy 2021-09-13 13:53:12 +03:00