Commit Graph

579 Commits

Author SHA1 Message Date
Alexander Udalov 6e67e1e78d Replace appendln with appendLine in project 2020-06-11 13:01:30 +02:00
Zalim Bashorov 7f41dc4828 Add more detailed message for EA-227305 and EA-226744 2020-05-28 21:38:00 +03:00
Zalim Bashorov f39165bb58 Revert accidentally pushed changes
Revert "~~~"

This reverts commit 03fcbfad

Revert "Add an ability to provide own handler for errors inside KotlinJavascriptMetadataUtils.loadMetadata"

This reverts commit 69827fc5

Revert "Add more detailed message for EA-227305 and EA-226744"

This reverts commit b79b3507
2020-05-26 16:15:59 +03:00
Zalim Bashorov b79b3507f2 Add more detailed message for EA-227305 and EA-226744 2020-05-26 15:41:47 +03:00
Svyatoslav Kuzmich c9adf22697 [JS] Remove binding context from NameSuggestion instance
Pass bindingContext to suggest method instead.
Revert creating multiple instances of NameSuggestion in checkers.
2020-05-22 17:05:30 +03:00
Svyatoslav Kuzmich 6e3d3831c2 [JS] JsExport diagnostics and legacy support
Account for JsExport in legacy backend namer. It means we
catch overloaded exported function conflicts for free!

Add error diagnostics:
* NESTED_JS_EXPORT (Fixes KT-36798)
* WRONG_EXPORTED_DECLARATION (Part of the fix for KT-37752)
* NON_EXPORTABLE_TYPE (Fixes KT-37771)
2020-05-22 10:50:22 +03:00
Alexander Udalov ea413cefb4 Remove TypeOfChecker for JVM frontend
This is needed to support typeOf with non-reified type parameters.

 #KT-30279
2020-05-13 10:04:26 +02:00
Anton Bannykh 442331acc9 IR JS: support findAssociatedObject feature (KT-37418 fixed) 2020-04-27 17:23:19 +03:00
Alexander Udalov fe5104b865 Move package org.jetbrains.kotlin.incremental.js to 'js.config'
This allows to replace dependency on 'js.frontend' with 'js.config', in
'kotlin-build-common' and 'daemon-common'. Also simplify some other
dependencies.
2020-03-28 21:30:05 +01:00
Alexander Udalov 143aef938b Extract module 'js.config' out of 'js.frontend'
This allows to get rid of dependency cli.common -> js.frontend.
2020-03-28 21:30:05 +01:00
Zalim Bashorov d07436c831 [IDE KJS] Move JsResolverForModuleFactory to proper place 2020-03-20 01:27:41 +03:00
Zalim Bashorov 5188bc6584 [JS FE] remove unused ReleaseCoroutinesDisabledLanguageVersionSettings 2020-03-13 01:51:24 +03:00
Zalim Bashorov 2a7e32d3ae [JS IR DCE] Add CLI option to print reachability info 2020-03-11 12:54:39 +03:00
Anton Bannykh 2742e643c1 JS: prohibit external fun interface 2020-02-26 18:57:11 +03:00
Anton Bannykh f20ed39b92 Fix a typo in an error message 2020-02-26 18:57:11 +03:00
Roman Artemev 6a37955a36 [KLIB] Implement new linker based on IdSignature
- Remove klib dependency on metadata and uniqID
 - Refactored proto format to make it more effective and compact
  -- Use special encoding for some types of data (coordinates, flags, types)
  -- Remove symbols table
  -- Use packed proto list if it is possible
 - Remove extension from metadata
 - Remove special ids for function interfaces
 - Fix klib IO
 - Fix incremental cache
 - General code clean up
2020-02-14 18:22:16 +03:00
Alexey Tsvetkov 2d598d50d7 Expand compilation scope for IC before backend is run
Sometimes IC raises compilation errors when rebuild succeeds.
This happens because IC uses serialized decriptors
for non-dirty files. Serialized descriptors can be different
from source file descriptors. For example, a source file
may contain an implicit return type or an implicit visibility
for overridden methods, but serialized descriptors always
contain explicit return types & methods' visibilities.

These problems can be solved by expanding a scope of incremental compilation
just after the analysis, but before error reporting & code generation.
In other words, we need to compare descriptors before error reporting and code generation.
If there are new dirty files, current round of IC must be aborted,
next round must be performed with new dirty files.

This commit implements IC scope expansion for JS Klib compiler

    #KT-13677
    #KT-28233
2020-01-21 16:36:36 +03:00
Zalim Bashorov 3fa431e114 [JS IR] Don't use full paths when generating comments with a path for file blocks 2019-11-21 23:51:09 +03:00
Zalim Bashorov c05c07f243 [JS IR] Generate special region comments at the start and the end of each file block
It allows to fold these blocks and navigate to them in the IDEA.

Also, this commit adds compiler configuration keys to control generating comments with paths for file blocks,
and now generating such comments is enabled only in our tests.
2019-11-21 23:51:08 +03:00
Roman Artemev 3795897fb7 [JS IR] Add developer mode in configuration 2019-11-19 11:15:35 +03:00
Roman Artemev 72c4be785d [JS IR] Add proper extension point in FE to customize incremental data loading
- fix IC klib
2019-11-08 14:14:57 +03:00
Alexander Udalov 59959c52ad Don't report missing reflection diagnostic for KType/KTypeProjection/KVariance 2019-10-29 15:52:01 +01:00
Alexander Udalov 896512f7cd Support KClass.isInstance/cast/safeCast in stdlib-only reflection implementation
#KT-14720 Fixed
2019-10-29 15:52:00 +01:00
Alexander Udalov c164745301 Support KClass.simpleName in stdlib-only reflection implementation
#KT-33646 Fixed
2019-10-29 15:51:21 +01:00
Leonid Startsev 395d595b22 Supply JVM and JS platforms when compile from CLI
To be able to check descriptor's platform in frontend during plugin processing.

This is needed for serialization plugin because some synthesized descriptors (annotation interface implementation) must be JVM-only (or the Native compilation fails).
2019-10-09 14:18:54 +03:00
Denis Zharkov 67410f7a57 Parametrize behavior of DescriptorEquivalenceForOverrides::areCallableDescriptorsEquivalent
The changes introduced 471134d31e are only needed
for the case of HMPP project while for other cases it might break the behavior
a bit like in KT-34027

See org.jetbrains.kotlin.resolve.calls.results.OverloadingConflictResolver#filterOutEquivalentCalls

Before 471134d we were comparing
"fun foo(x: String)" with "[substituted] fun foo(x: String)"
and areCallableDescriptorsEquivalent returned false for such case.
Thus, both overrides were left in the resulting set.

After 471134d, those two descriptors
becamed considered as equal thus having a possibility to remove any of them.

The problem is that "areCallableDescriptorsEquivalent" has kind of
unclear contract. Effectively it checks whether two descriptors match
to the same declaration

But straightforward fixing of this exact call-site (using original descriptors)
doesn't help: behavior might change in a very subtle way (see org.jetbrains.kotlin.spec.checkers.DiagnosticsTestSpecGenerated.NotLinked.Dfa.Pos#test72)

So, the main idea is changing the contract for areCallableDescriptorsEquivalent
only when project is HMPP one.

^KT-34027 In Progress
2019-09-30 20:09:42 +03:00
Anton Bannykh ead8379c50 JS: add -Xmetadata-only flag for JS common code modules (KT-33142 fixed) 2019-09-27 19:12:03 +03:00
Svyatoslav Kuzmich 7592048437 [JS] Support typeOf 2019-09-25 18:12:55 +03:00
Roman Artemev 3753b75609 [JS KLIB IC] Implement incremental cache for IR 2019-09-03 14:21:32 +03:00
Zalim Bashorov 21b2487290 Minor: add an additional message for further investigation EA-141821 2019-08-27 18:19:18 +03:00
Dmitry Savvinov 0065236bde Move default implementation of TargetPlatform.platformName to leaf classes
Otherwise, we have a static initialization loop, leading to null-leaks

Removing default interface method indeed disconnects the loop, as per JVM
Specification, "5.5 Initialization".

See KT-33245 for detailed explanations

^KT-33245 Fixed
2019-08-12 13:06:51 +03:00
Dmitry Savvinov b48218e722 [Resolve] Make ResolversForModule less static
As consequence, remove IdePlatformKindTooling.resolverForModule, because
it became more than just field, and it duplicates similar API in
IdePlatformKindResolution anyways
2019-07-30 12:41:40 +03:00
Dmitry Savvinov ab9ff786d7 [Invariant Fix] Use structural descriptor equivalence in JsNamesClashChecker
It's needed for situation when we have JS module with expect declaration,
so we refine member scope for that expect declaration and try to
compare to function descriptors (e.g. of `equals` function) from
different class descriptors (expect and actual) and report diagnostic
about name clash. So, since we can earn descriptors from type refinement,
they can be not identical but still equals, so with should use structural
equality to comparing them
2019-07-30 12:41:38 +03:00
Dmitry Savvinov 0915f0c78a [Expect/Actual] Let DI instantiate ExpectedActualDeclarationChecker
Inject it instead of calling constructor manually and passing instance
directly into the container. This allows to accept some components in
constructor of ExpectedActualDeclarationChecker
2019-06-10 13:34:27 +03:00
Mikhail Zarechenskiy 787a8bb9bd Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit 7c4101e21c.

 #KT-31866 Fixed
 #KT-31868 Fixed
 #EA-125401 Fixed
 #KT-25290 Open
2019-06-07 12:31:38 +03:00
Dmitriy Novozhilov 7c4101e21c [NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI 2019-05-29 10:35:46 +03:00
Mikhail Zarechenskiy 848640253a Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit f20ec3e0a6.
2019-05-29 01:31:28 +03:00
Anton Bannykh c3170d1908 JS: cache metadata, grouped by package FQN 2019-05-28 23:33:17 +03:00
Dmitry Savvinov 9d0f518d62 Rename PlatformDependentCompilerServices -> PlatformDependentAnalyzerServices 2019-05-28 13:08:09 +03:00
Dmitry Savvinov 2caa1c3dd6 [Compatibility] Restore old TargetPlatform and subtypes for compatibility 2019-05-28 13:08:08 +03:00
Dmitry Savvinov 4116815a8d [Misc] Provide meaningful debugName for StorageManager everywhere 2019-05-28 13:08:08 +03:00
Dmitry Savvinov 602f642018 [Injection] Make component containers composition more granular and flexible
Previously, containers set-up was performed by calls to static functions
like 'createContainerForLazyResolve', which would set-up whole container
from scratch.

This has several issues:
- complicates code re-use and encourages copy-paste of one and the same
set-up logic
- complicates composition of multiplatform containers (because each
set-up method relies on the fact that it should take an empty
container and compose it completely)

The idea of this commit is to split set-up methods into smaller ones,
with finer areas of responsibility, which allows to re-use them
in various scenarios (and, in particularly motivating composition
of multiplatform container)
2019-05-28 13:08:08 +03:00
Dmitry Savvinov b631e89ea7 [Injection] Annotate default services with @DefaultImplementation 2019-05-28 13:08:08 +03:00
Dmitry Savvinov c97138c0eb [Injection] Pull languageVersionSettings injection to 'configureModule' 2019-05-28 13:08:08 +03:00
Dmitry Savvinov 1606b3bf23 [Platform API] Make 'ModuleInfo.platform' non-nullable 2019-05-28 13:08:07 +03:00
Dmitry Savvinov d5fbe59a3e [Platform API] Introduce fundamental abstraction of Platform
This is a large commit, which introduces general API for working with
abstraction of Platform.

- Add new abstraction to 'core' - SimplePlatform - which represents
exactly one platform
  - Clients are strongly prohibited to create instances of SimplePlatform
  by hand, instead, corresponding *Platforms abstraction should be used
  (e.g. JvmPlatforms, JsPlatforms, KonanPlatforms)

- Move TargetPlatform to 'core', it represents now a collection of
SimplePlatforms
  - Clients are strongly encouraged to use TargetPlatform
    (not SimplePlatform) in API, to enforce checks for multiplatform

- Provide a helper-extensions to work with TargetPlatform
(in particular, for getting a specific component platform)

- Remove MultiTargetPlatform in favour of TargetPlatform
  - Notably, this commit leaves another widely used duplicated abstraction,
    namely, IdePlatform. For the sake sanity, removal of IdePlatform is
    extracted in the separate commit.
2019-05-28 13:08:07 +03:00
Dmitry Savvinov 451d14e504 [Platform API] Minor: move some classes to separate files 2019-05-28 13:08:07 +03:00
Dmitry Savvinov f2a0a809f1 [Platform API] Split TargetPlatform into lightweight TargetPlatform and CompilerServices
This decouples simple data (TargetPlatform) from other subsystem-specific
logic (like default imports, built-ins, etc.).

Aside from purely aesthetic improvements, it also makes it easier
to move 'TargetPlatform' into core (see next commits)
2019-05-28 13:08:06 +03:00
Dmitry Savvinov 83914614b9 [Platform API] Clean-up some usages of Platform
Mostly unused imports. Also, in some places,
TargetPlatform/MultiTargetPlatform were just passed around without
actually using (e.g. in deserialization)
2019-05-28 13:08:06 +03:00
Dmitry Savvinov 520e871280 Rename *AnalyzerFacade to *ResolverForModuleFactory to prevent confusion with other similar names 2019-05-28 13:08:06 +03:00