Commit Graph

503 Commits

Author SHA1 Message Date
Denis.Zharkov 18e93b50d9 FIR: Fix loading read-only collection Java types with incorrect variance 2021-06-07 15:25:56 +03:00
Mikhail Glukhikh 1294c8de53 FIR: don't get class symbol if it's unnecessary (Java type conversion) 2021-06-03 16:14:41 +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
Dmitriy Novozhilov dbccd4d459 [FIR] Properly acquire module data in FirSignatureEnhancement 2021-05-18 20:56:04 +03:00
Andrey Zinovyev dc9d5cdf35 [FIR] Handle of special getters when there is a kotlin super type
Special getter names (like Collection.size()) can be used only in Java
classes with all-java super-types
Because if there is a kotlin class (not interface) in
 the middle, we 'materialize' special getters to properties.
2021-05-14 15:38:09 +03:00
Dmitriy Novozhilov 43b075d452 [FIR] Add path normalization to LibraryPathFilter 2021-05-14 14:30:43 +03:00
Dmitriy Novozhilov 28be3a0dbc [FIR] Replace Path with String in KotlinJvmBinaryClass.containingLibrary
This is needed because :core:deserialization.common.jvm uses JDK 6
2021-05-14 14:30:37 +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 c523379e6a [FIR] Move out all JVM specific deserialization logic from AbstractFirDeserializedSymbolsProvider 2021-05-14 14:30:23 +03:00
Dmitriy Novozhilov e8c4b0e947 [FIR] Rename KotlinScopeProvider to FirKotlinScopeProvider 2021-05-14 14:30:22 +03:00
Dmitriy Novozhilov 4ad7a4a2d1 [FIR] Split KotlinDeserializedJvmSymbolsProvider to common and JVM specific parts 2021-05-14 14:30:21 +03:00
Dmitriy Novozhilov d114913cd2 Replace usages of addToStdlib.firstNotNullResult with firstNotNullOfOrNull 2021-05-14 14:30:19 +03:00
Mikhail Glukhikh 7ee6597873 FIR: make inference context mandatory in withNullability() etc. 2021-05-05 17:35:50 +03:00
Dmitriy Novozhilov d4162f876f [FIR] Fix some warnings 2021-04-22 14:32:06 +03:00
Dmitriy Novozhilov 234ab3b35d [FIR] Fix all illegal usages of declarationSiteSession in compiler
There are still some usages in IDE which should be investigated
2021-04-22 14:32:04 +03:00
Dmitriy Novozhilov f98f41bbc3 [FIR] Rename session to declarationSiteSession in declaration builders 2021-04-22 14:32:03 +03:00
Dmitriy Novozhilov c3b1be1a39 [FIR] Rename FirDeclaration.session to declarationSiteSession 2021-04-22 14:32:02 +03:00
Ilya Kirillov a76c5d66eb FIR: introduce FirDeclarationBuilder as a base class for all FIR declaration builders 2021-04-21 21:16:58 +03:00
Ilya Kirillov 39b2cd1027 FIR: do not provide symbols with different ClassId in JavaSymbolProvider
JavaSymbolProvider uses KotlinPsiElementFinderWrapper for finding classes.
CliFinder looks for Java classing assuming that class with ClassId=a/b/C
lives in directory a/b and do not look into real package name of Java class.
This causes that we may find some classes which we should not see from current scope.

Also, the IDE implementation works correctly here (it also checks file package)
which cause different behaviour of FIR IDE and FIR

This change also requires to fix testdata and make Java classes live
in directory consistent with file package
2021-04-15 15:23:53 +03:00
Ting-Yuan Huang 6c989bfd4b Support array of annotation in KotlinJvmBinaryClass
KotlinJvmBinaryClass.AnnotationArrayArgumentVisitor didn't cover the
case when the element type is an Annotation. Therefore, when the
compiler read an array of annotations from JVM binary classes built from
Kotlin sources, it got an empty array regardless of what was written in
the bytecode.

For example, Foo.value below is read as an empty array when SomeClass
resides in another Kotlin module.

  @Foo(
    value = [Bar(1), Bar(2)]
  )
  class SomeClass
2021-04-14 13:14:26 +02:00
Mikhail Glukhikh 9af1de272e FIR: support private-in-file effective visibility 2021-04-08 09:41:26 +03:00
Abduqodiri Qurbonzoda 19116e5623 Migrate compiler and others from sumBy to sumOf 2021-04-08 03:48:02 +03:00
Igor Yakovlev d05ef3a635 [FIR] Move standard class id's into common module 2021-04-07 11:25:21 +02:00
Dmitriy Novozhilov 3ef87d0265 [FIR] Add effective visibility to resolved status
This commit includes:
- introduce FirResolvedDeclarationStatus.effectiveVisibility
- replace FirEffectiveVisibility with EffectiveVisibility
- move calculation of effective visibility from FirEffectiveVisibilityResolver
  (which is deleted) to FirStatusResolver and FirDeserializer
2021-04-06 12:30:46 +03:00
Ilya Kirillov 5ceec858aa FIR IDE: do not search for sealed class inheritors on every class resolve 2021-04-02 17:15:30 +02:00
Denis.Zharkov 1f074326bf FIR: Fix Java scope in case of accessor with getter signature from supertype
^KT-45584 Fixed
2021-03-31 15:57:02 +03:00
pyos 6c11751c55 FIR: infer non-error types for unnamed annotation arguments 2021-03-30 16:20:01 +03:00
Ilya Chernikov f8d50d585d FIR: Implement lookup tracking 2021-03-24 21:24:18 +01:00
pyos 651fd4ad9f FIR: load Java annotation defaults after binding the class symbol
as they can refer to the class itself.
2021-03-24 16:09:25 +03:00
Dmitriy Novozhilov f4afc2ef44 [FIR] Map dispatch receiver type of function in JvmMappedScope 2021-03-24 12:56:16 +03:00
Mikhail Glukhikh e7129329d2 Revert "FIR: do not eagerly resolve class references in imported annotations"
This reverts commit 1a57d60f
2021-03-15 18:36:13 +03:00
pyos 1a57d60f68 FIR: do not eagerly resolve class references in imported annotations 2021-03-15 17:32:39 +03:00
Mikhail Glukhikh c641fa739b FIR: provide 'replaceSource' only for FirQualifiedAccess inheritors 2021-03-15 15:33:38 +03:00
Dmitriy Novozhilov 3d1f4b8386 [FIR] Don't add @EnhancedVisibility to types with @Nullable annotation 2021-03-15 12:13:06 +03:00
Dmitriy Novozhilov 932eed2c14 [FIR] Fix determining nullability of arguments during enhancement 2021-03-11 13:10:05 +03:00
Dmitriy Novozhilov 65ea4e184a [FIR] Fix enhancement of FlexibleNullability and EnhancedNullability
- Add utilities to add new attribute to ConeAttributes
- Get rid of FlexibleNullability attribute (it can be easily inferred
    for any flexible type at any moment)
- Fix determining of EnhancedNullability attribute
2021-03-11 13:10:04 +03:00
Dmitriy Novozhilov bd7689d381 [FIR] Properly compute default arguments of java annotations 2021-03-05 13:00:11 +03:00
Dmitriy Novozhilov d45709993e [FIR] Support reading annotations of properties from interfaces in different jvm default modes 2021-03-02 19:11:28 +03:00
Dmitriy Novozhilov a7e6667648 [FIR] Properly deserialize annotations of properties in interfaces 2021-03-02 19:11:24 +03:00
Dmitriy Novozhilov af79265f42 [FIR] Fix creating overrides for functions with name same as renamed in JVM builtins 2021-03-02 19:11:15 +03:00
Mikhail Glukhikh 2bf3abcb29 FIR: cache accessor symbols in JavaClassUseSiteMemberScope 2021-02-26 12:27:07 +03:00
Mikhail Glukhikh 750a39a053 JavaClassUseSiteMemberScope: optimize createOverridePropertyIfExists
Avoid calculating getter & setter twice
2021-02-26 12:27:01 +03:00
Ilya Kirillov 83f8650e80 Move CallableId from fir module to compiler.common to use in IDE 2021-02-24 20:13:41 +01:00
Denis.Zharkov fb8314f6e7 FIR: Fix enhancement of property overrides accessors in Java 2021-02-20 10:59:21 +03:00
Denis.Zharkov 45018ea468 FIR: Rework loading overrides of special built-in methods from Java
Some of the changed data is correct, but some diagnostics are incorrect
Corner cases like having both contains(Object) and contains(String)
within implementation of Collection<String> is not supported
2021-02-20 10:59:21 +03:00
Denis.Zharkov 4b0aeb7105 FIR2IR: Support initialSignatureDescriptor
It will be used for overrides of renamed special built-ins during signature mapping
to obtain initial signature
2021-02-20 10:59:21 +03:00
Denis.Zharkov 3e420ca4e3 FIR: Introduce FirDeclarationOrigin.BuiltIns 2021-02-20 10:59:21 +03:00