Commit Graph

624 Commits

Author SHA1 Message Date
Denis.Zharkov 360d67410d FIR: Fix overridability rule for Java declarations with different return type kinds
See the class at org/jmock/Expectations
public <T> T with(Matcher<T> matcher);
public boolean with(Matcher<Boolean> matcher);

When we extending such class it we start assuming
that fake generic override overrides both of the overridden that is wrong
from POV of Java and it fails at FIR ultimate build

NB: It's hard to write a test because such Expectation-like
class is impossible to write in pure Java
2021-11-02 19:08:28 +03:00
Dmitriy Novozhilov 4490f64666 [FIR] Get rid of FirAnnotatedDeclaration
Now all fir declarations have annotations

^KT-49260 Fixed
2021-10-28 15:01:18 +03:00
Ilya Chernikov a65beb2dc5 Move Fir*SourceElement to frontend.common, rename to Kt* (complete) 2021-10-27 21:44:11 +02:00
Denis.Zharkov 5690a9f21b FIR: Fix overridability of Kotlin vararg from Java 2021-10-26 18:45:59 +03:00
Denis.Zharkov 52c2908bb7 FIR: Fix another inconsistency with FE1.0 in synthetic properties resolution 2021-10-26 18:45:59 +03:00
Denis.Zharkov 35a7f0f73e Minor cleanup 2021-10-26 18:45:58 +03:00
Tianyu Geng f23256bf49 FIR: filter out builtin symbols in JvmClassFileBasedSymbolProvider
These symbols are already provided by FirBuiltinSymbolProvider.
2021-10-23 15:33:31 +02:00
Mikhail Glukhikh 79b98f9173 FIR: introduce synthetic property symbol hierarchy 2021-10-23 01:19:07 +03:00
Mikhail Glukhikh c673c4cc91 FIR: refactor/use properly FirAccessorSymbol & FirSyntheticPropertySymbol 2021-10-23 01:19:06 +03:00
Mikhail Glukhikh 7b9ac4c5f7 FIR: create constructors copies with correct containers in JvmMappedScope
#KT-49133 Fixed
2021-10-23 01:17:10 +03:00
Denis.Zharkov 4ad5f01324 FIR: Support overrides of generic-typed members with raw-typed ones
^KT-49070 Fixed
2021-10-20 22:05:25 +03:00
Mikhail Glukhikh 98d34b40ab FIR: set substituteTypes value explicitly in calls inside providers 2021-10-20 12:17:04 +03:00
Dmitriy Novozhilov bee44c6e0f [FIR] Split :compiler:fir:resolve module into three different modules
Those modules are:
- :compiler:fir:providers, which contains Fir and Symbol providers,
    scopes, and different utilities used by them
- :compiler:fir:semantics, which contains different abstractions and
    entities which are used in resolution and in checkers
- :compiler:fir:resolve, which contains all stuff related to resolution
    and inference

There are two pros of this change:
1. It may increase gradle build, because it allows to compile :fir:resolve
  and :fir:checkers modules in parallel
2. Logic of working FIR (scopes, providers, DFA logic system, etc) is
  now separated from logic of resolution phases, so for example checkers,
  which are depend on scopes physically will not be able to run resolve
  in any way
2021-10-18 11:10:47 +03:00
Dmitriy Novozhilov 6995ee9334 [FIR] Move type context and type approximator to separate session compontent
This is needed to decouple components which are related to type system
  from type inference components
2021-10-18 11:10:47 +03:00
Dmitriy Novozhilov eadb91f9b2 [FIR] Move accessors to main session components close to declarations of those components 2021-10-18 10:55:39 +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
Dmitriy Novozhilov b4d955838e [FIR] Properly use FirContainingNamesAwareScope in all places
Split some delegating scopes to basic and name aware implementations

Also get rid of getContainingCallableNamesIfPresent and
  getContainingClassifierNamesIfPresent functions because they are not
  needed anymore
2021-10-12 17:26:43 +03:00
Dmitriy Novozhilov af6d6ec2b9 [FIR] Properly collect constructors from class in presence of plugins 2021-10-12 17:26:41 +03:00
Dmitriy Novozhilov 9bfa6c54b8 [FIR] Inherit FirContainingNamesAwareScope from FirScope
This is needed to simplify FirScope hierarchy, because in
  fact all inheritors of `FirContainingNamesAwareScope` were
  inheritors of `FirScope` too
2021-10-12 17:26:29 +03:00
Denis.Zharkov 9d9f191f51 FIR: Fix exception caused by empty supertypes of java.lang.Object 2021-10-07 17:26:25 +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
Ivan Kochurkin 75b40e4b75 [FIR] Add INVISIBLE_SETTER 2021-10-03 17:10:06 +03:00
Tianyu Geng f35680f0a4 FIR checker: resolve property with protected getter and public setter
Assuming Java class `Super` has a protected `getName` method and a
public `setName` method.

Then, in a subclass of `Super`, FE1.0 allows calls to `setName` via the
property syntax if the property is protected and invisible due to
dispatch receiver is not `this` or `super`.
2021-09-29 19:39:12 +03:00
Denis.Zharkov 9ac29e0714 Fix enhancement when mixing TYPE_USE and non-TYPE_USE annotations 2021-09-28 22:59:18 +03:00
Denis.Zharkov 586dcae141 FIR: Avoid loading symbols when mapping Java type arguments 2021-09-23 16:58:26 +03:00
Denis.Zharkov 38fa900e56 FIR: Optimize case with no annotations on package 2021-09-23 16:58:26 +03:00
Denis.Zharkov 37785eb244 FIR: Rename KotlinDeserializedJvmSymbolsProvider -> JvmClassFileBasedSymbolProvider 2021-09-23 16:58:25 +03:00
Denis.Zharkov 0aa8181960 FIR: Rename AbstractFirDeserializedSymbolsProvider -> AbstractFirDeserializedSymbolProvider 2021-09-23 16:58:25 +03:00
Denis.Zharkov 54a97a860a FIR: Minor. Rename JavaClassConverter -> FirJavaFacade 2021-09-23 16:58:24 +03:00
Denis.Zharkov 9902d36d57 FIR: Minor. Rename 2021-09-23 16:58:24 +03:00
Denis.Zharkov 1fc2f13a35 FIR: Pull creation of JavaClassConverter to session factory 2021-09-23 16:58:22 +03:00
pyos 36b02082a6 FIR: try to load as Java class if KotlinClassFinder returns null
The IDE implementation of KotlinClassFinder does not always return the
class file contents.
2021-09-15 19:15:17 +03:00
Dmitriy Novozhilov 9d09b9605f [FIR] Cleanup and reorganize utils in :compiler:fir:java 2021-09-15 17:11:30 +03:00
Dmitriy Novozhilov 7a347b11e3 [FIR] Use StandardClassIds instead of StandardNames everywhere it's possible 2021-09-15 17:11:30 +03:00
Dmitriy Novozhilov 5c2a3bb78e [FIR] Move duplicating names and classIds to StandardClassIds 2021-09-15 17:11:29 +03:00
pyos 9fa3e2eb13 FIR: always load parents of nested classes first 2021-09-14 19:00:48 +03:00
pyos 032cf5a892 FIR: JavaSymbolProviderWrapper -> JavaSymbolProvider 2021-09-14 19:00:47 +03:00
pyos 30c8fa89f6 FIR: rename JavaSymbolProvider to JavaClassConverter 2021-09-14 19:00:46 +03:00
pyos 3a80cb1808 FIR: hide construction of JavaSymbolProvider 2021-09-14 19:00:45 +03:00
pyos 8ff79e002e FIR: load parents of Java inner classes first, as before 2021-09-14 19:00:44 +03:00
pyos cac0cf6a50 FIR: join KotlinDeserializedJvmSymbolsProvider and JavaSymbolProvider
This allows reusing class finder results.
2021-09-14 19:00:43 +03:00
Dmitriy Novozhilov d1db9b17e5 [FIR] Add workaround for KT-48675 2021-09-13 13:53:13 +03: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 2e7564a21e [FIR] Properly create FirAnnotation and FirAnnotationCall in all places 2021-09-13 13:53:12 +03:00
Dmitriy Novozhilov 4b662a42a1 [FIR] Rename FirAnnotationCall to FirAnnotation 2021-09-13 13:53:09 +03:00
Nikolay Lunyak b72488b4c2 [FIR] Add replaceGetter & replaceSetter 2021-09-11 22:05:33 +03:00
Nikolay Lunyak ee58df6b3c [FIR] Add FirBackingField 2021-09-11 22:05:29 +03:00
Ivan Kochurkin 7c6326856b [FIR] Use toFirRegularClassSymbol instead of toFirRegular in checkers 2021-09-10 00:49:11 +03:00
Ivan Kochurkin ee37768808 [FIR] Rename getClassLikeSymbolFqName to getClassLikeSymbolByClassId 2021-09-10 00:49:10 +03:00
Ivan Kochurkin f3e754f314 [FIR] Remove excess FirAnnotationContainer from some super types 2021-09-10 00:49:08 +03:00