Commit Graph

2991 Commits

Author SHA1 Message Date
Vladimir Dolzhenko 2c8d583d8b Added ad-hoc KtValueArgument.stringTemplateExpression
Use only stub stringTemplateExpression if it is present and don't use ast nodes as it could be unbounded

#KT-47034 Fixed
2021-06-10 21:14:32 +00:00
Dmitry Savvinov 708fead1cc Add debug strings to frontend scopes-related structures
Such as:
- PackageFragmentProviders, and, in particular,
CompositePackageFragmentProviders
- JavaPackageFragments
- Scopes produced by those providers

The rationale is that a lot of frontend-facing bugs (like red code) are
easily recognizeable in resolution. But at that point you just see a
bunch of scopes, without meaningful toStrings, you don't know who has
produced them, and what's exactly wrong.

With this commit it should make debugging slightly easier: now at least
you'll be able to see that "this scope is a scope of package fragment
for foo.bar of module baz" and decide whether the declaration should or
should not have been resolved from such scope.
2021-06-03 17:21:59 +03:00
Victor Petukhov 5a11450d77 Split stub types into stub type for subtyping and for builder inference and use them in the proper way 2021-05-28 15:36:17 +03:00
Victor Petukhov b78c645fb0 Report warnings by enhanced base types 2021-05-18 17:52:39 +03:00
Victor Petukhov 937e82db46 [Jspecify] Report warnings on violated bounds of method type parameters 2021-05-18 17:52:06 +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 d114913cd2 Replace usages of addToStdlib.firstNotNullResult with firstNotNullOfOrNull 2021-05-14 14:30:19 +03:00
Vladimir Dolzhenko cf5e6b242b Wrap exception with file details
Relates to #KT-39776
2021-05-07 23:48:12 +02:00
n-p-s d70b889004 Update declarations to be searchable by their JvmName annotation
Relates to #KT-23653
2021-05-07 17:43:26 +03:00
Victor Petukhov 2e57ff25ee Leave KotlinCliJavaFileManager::findClass only passing JavaClassFinder.Request 2021-04-30 14:43:27 +03:00
Victor Petukhov bc5e92033b Support reading annotations on java 9 module on sources and binaries 2021-04-30 14:43:27 +03:00
Victor Petukhov 49e838781c Clean-up JavaModuleInfo.kt 2021-04-30 14:43:25 +03:00
Andrey Zinovyev 01dd3d6ed4 [lombok] Refactoring, cleaning, better tests
Add assertions to tests
Add lombok license
Provide String.[de]capitalize() implementation
Get rid of weak map because it seems it is useless here
2021-04-25 18:18:18 +03:00
Andrey Zinovyev f71e08df4d [lombok] Experimental lombok plugin prototype
Add extension point for java descriptors
Add simple usage of this point to generate getter method
Add simple test infrastructure to test compilation with lombok plugin
2021-04-25 18:17: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
Andrey Zinovyev 8c464b4de5 [KAPT] Bring back properties resolution in light analysis
Because kapt fails on evaluation constant expressions of SomeType::class
2021-04-14 07:50:22 +00:00
Denis.Zharkov 0b0a6d6ede Fix false positive ENCLOSING_SUSPEND_FUNCTION_FOR_SUSPEND_FUNCTION_CALL
Previously added additional processing at findEnclosingSuspendFunction
seems unnecessary anymore

^KT-43258 Fixed
2021-04-13 11:47:05 +03:00
Vladimir Dolzhenko e511eec90e Added optimized PackageFragmentProvider#isEmpty(FqName) 2021-04-09 09:27:39 +00:00
Abduqodiri Qurbonzoda 40d1849f33 Migrate compiler, idea and others to new case conversion api 2021-04-08 03:22:02 +03:00
Him188 f90cbb0ce7 Support properties from primary constructor in JvmFieldApplicabilityChecker
#KT-32753 In progress
2021-04-06 11:40:44 +03:00
Ting-Yuan Huang e0c28e27d2 Move AnalysisHandlerExtension out of frontend.java
A dummy AnalysisHandlerExtension that extends the new extension is kept
in frontend.java for backward compatbility.
2021-03-29 20:41:01 +03:00
Mark Punzalan dd20dd9806 Report WRONG_MODIFIER_TARGET on the modifier instead of the declaration
in ExternalFunChecker.

This allows RemoveModifierFix to provide a quickfix to remove it.
2021-03-27 22:27:36 +01:00
Victor Petukhov 731e3ebae1 Rename LV ImprovementsAroundTypeEnhancement into TypeEnhancementImprovementsInStrictMode 2021-03-26 11:03:49 +03:00
Ilya Chernikov 3e458a1efb FIR: Add IncrementalPackagePartsProvider usage in cli...
also refactor IncrementalPackagePartsProvider and parents to simplify
usage
2021-03-24 21:24:18 +01:00
Victor Petukhov 80ac62864d Don't lose inference session in all the possible locations 2021-03-24 15:57:47 +03:00
Ilmir Usmanov 164e9034d1 IC MPP: Allow expect value classes without @JvmInline
#KT-45525 Fixed
2021-03-22 11:13:13 +00:00
Ilmir Usmanov a90a5f6dd4 Check for backend when checking for suspend in fun interfaces 2021-03-16 22:37:44 +01:00
Alexander Udalov bc5fc122c5 JVM, JVM IR: report error if not all parts of multifile class are @JvmSynthetic
#KT-41884 Fixed
2021-03-11 13:33:25 +01:00
Mikhael Bogdanov 4d51d71699 Fix EXPLICIT_OVERRIDE_REQUIRED_IN_MIXED_MODE message 2021-03-08 17:52:52 +00:00
Mikhael Bogdanov 3568eba1b2 Use actual implementation instead of inherited one in -Xjvm-default diagnostics 2021-03-08 17:52:52 +00:00
Mikhael Bogdanov 71c134e54f Fix checker for -Xjvm-defaults 2021-03-08 17:52:51 +00:00
Alexander Udalov 9970851684 Restore writing bytecode version to metadata for LV < 1.5
#KT-45323 Fixed
2021-03-08 11:18:54 +01:00
Andrey Zinovyev b128577508 [KAPT] Some optimizations for stubs generation
* Add index to resolve compiled class by name
* Disable full property resolution
2021-03-03 12:05:49 +03:00
Vladimir Dolzhenko 81efdab4e4 Do not swallow any exceptions apart FNFE
Relates to #KT-39776
2021-02-24 11:06:49 +00:00
Vladimir Dolzhenko b8d1bbdd0d Do not swallow PCE
#KT-39776 Fixed
2021-02-19 15:04:45 +00:00
Victor Petukhov ad9fd7ecf3 KotlinBinaryClassCache: clean-up request caches for all threads
^KT-44550 Fixed
2021-02-18 17:05:59 +03:00
Alexander Udalov 3432f581cb Remove compiler support for kotlin-annotations-android
#KT-44815
2021-02-15 17:23:44 +01:00
Victor Petukhov 0d40022d6d Add reporting of the warnings based on Java annotations for expanded type aliases
Before that, such warnings weren't reported as the corresponding errors were reported during type inference (only original types took part there)
2021-02-15 12:13:55 +03:00
Victor Petukhov d783d99443 Use upper bound checker for typealias expansion 2021-02-15 12:13:53 +03:00
Victor Petukhov befe8599c4 Report warnings or errors for violated type parameter's upper bounds from Java annotated with nullability annotations
^KT-43262 Fixed
2021-02-15 12:13:50 +03:00
Victor Petukhov a94086224d Clear request cache properly during disposing component 2021-02-15 11:13:11 +03:00
Alexander Udalov adfa8c788c Light classes: use JVM target from the module
Using "JVM_1_8" always resulted in incorrect mapping of Kotlin
annotation targets to Java element types.

The change in AbstractKotlinRenderLogTest is needed because while
CliTraceHolder.module is technically a descriptor leak, it was never
detected by this test accidentally, because of the depth cutoff equal to
10, which started to not be enough after the minor refactoring of
replacing `Delegates.notNull` with `lateinit`.
2021-02-01 11:54:05 +01:00
Victor Petukhov 670f029bdf Allow passing non-spread arrays into a vararg parameter after sam properly, through propagating vararg element type to a sam adapter from the original parameter descriptor 2021-01-28 13:19:31 +03:00
Pavel Kirpichenkov c0dd731818 Load JVM built-ins in IDE from module dependencies
Fix built-ins for JVM platform and make them consistent
with module's dependency on standard library. Changes
don't affect non-JVM platforms.

Previously all built-ins in IDE were loaded from classloader
and were based on the same pre-serialized .kotlin_builtins files.
This approach is generally not correct as built-in declarations
differ for different platforms, but it had been working for a while
without immediately observalble effects (see KT-33233 for more info).
After changes in standard library JvmBuiltins started producing
false errors (see KT-39728).

To fix this, JVM built-ins in IDE now utilize the same technique as
applied in CLI: using dependency on standard library as a module
for built-ins instead of artificial module that considers only
.kotlin_builtins.

Change summary:
- Provide JvmBuiltins with kind FROM_DEPENDENCIES
  for all modules with stdlib dependency in IDE
- Add JvmBuiltinsPackageFragmentProvider to JVM-ish module resolvers
  (JVM and Composite with JVM platform) to support their use as
  built-ins module
- Create KotlinBuiltInsMetadataIndex file index for tracking libraries
  containing .kotlin_builtins to support JvmBuiltinsPackageFragmentProvider
- Create KotlinStdlibIndex file index for tracking kotlin-stdlib(-common),
  which looks for "Kotlin-Runtime-Component" manifest attribute
- Add caching service to track LibraryInfo for kotlin-stdlib(-common)
- Put LibraryInfo for kotlin-stdlib(-common) alongside SDKs
  due to the need to resolve that modules in BuiltInsCache
- Update BuiltInsCache to separate JvmBuiltins by module's dependency
  on stdlib and JDK
- Make platform of KotlinSDK common instead of JVM
- Set built-ins module lazily in IDE

^KT-33233 Verification Pending
2021-01-14 17:28:15 +03:00
Dmitry Savvinov 1479c7a270 Minor: load FALLBACK built-ins in JvmPlatformAnalyzerServices
It doesn't matter because this built-ins instance will be used only to
get names of default imports, so nothing can be resolved to those
built-ins => no diagnostics will be reported
2021-01-14 17:28:15 +03:00
Victor Petukhov 27dd9484ba Add missed type arguments for a star projection into the enhanced type arguments list 2020-12-29 11:31:16 +03:00
Denis.Zharkov 5a8dc00a0d Rename JvmBuiltInsSettings -> JvmBuiltInsCustomizer 2020-12-24 14:06:19 +03:00
Victor Petukhov 9a52863fbd Report warnings about type mismatches based on freshly supported nullability annotations deeply 2020-12-18 19:32:05 +03:00
Victor Petukhov 9693ea19fb Add tests for type enhancement uncluding with compiled java 2020-12-18 19:32:05 +03:00