Commit Graph

2929 Commits

Author SHA1 Message Date
Yan Zhulanow 0a092d6613 Debugger: Fix breakpoint firing in '$suspendImpl' (KT-27645) 2019-08-07 01:15:33 +09:00
Yan Zhulanow 89c45e9e3f Fix stub loading for crossinline lambdas compiled by older Kotlinc (EA-105730)
Older kotlinc versions (1.1.5?) didn't generate the 'INNERCLASS' attribute for some anonymous classes, e.g. for 'crossinline' lambdas.
An example: 'Timer().schedule(1000) { foo () }'

Normally, stub loader checks if the class is 'ClassFileViewProvider.isInnerClass()', and ignores the class file.
Without the 'INNERCLASS' attribute this check fails. As the stub loaded isn't created to deal with anonymous classes nicely, it fails miserably.
This commit explicitly ignores classes with local visibility.
2019-08-07 01:15:32 +09:00
Yan Zhulanow 129ca7f2d8 Debugger: Fix breakpoint applicability (KT-10984)
Ensure that breakpoints of each type can be placed only on lines where it makes sense to place a breakpoint.

Here is a quick summary of the rules:
1. Method breakpoints are available for functions, property accessors, constructors;
2. Line breakpoints are available on any line with an expression, excluding some cases like 'const' property initializers or annotations;
3. Line breakpoints should be available on a '}' in functions and lambdas;
4. Line breakpoints are not suggested for one-liners;
5. Lambda breakpoints should be shown for single-line lambdas.
2019-08-07 01:15:27 +09:00
Yan Zhulanow 22c18ffaa9 Debugger: Add Kotlin Function breakpoints (KT-22116)
Now it's possible to put a function breakpoint.
In JVM, function breakpoints behave as JVM method breakpoints. Normally, they're triggered twice – once on enter, and once on exit.
2019-08-07 01:15:27 +09:00
Ilya Kirillov 02f2009f2a Do not show "Replace overloaded operator with function call" intention on incomplete expressions
#KT-33115 fixed
2019-08-05 15:14:27 +03:00
Dmitry Gridin 832c8e0e20 Fix "Non default constructors for extension class" 2019-08-02 19:19:47 +03:00
Nikolay Krasko ce3ad8f4da Use kotlin specific OOCB tracker for light classes inner cache
ClassInnerStuffCache from the platform caches everything with platform
OUT_OF_CODE_BLOCK tracker.
2019-08-01 18:16:35 +03:00
Mikhail Glukhikh 869e970bfd FIR resolution API: fix handling of expressions inside imports 2019-07-30 16:28:18 +03:00
Mikhail Glukhikh 1f771a2407 FIR resolution API: fix handling of expressions inside secondary ctors 2019-07-30 16:28:18 +03:00
Mikhail Glukhikh 2a69efba8a FIR resolution API: fix handling of expressions inside local functions 2019-07-30 16:28:18 +03:00
Mikhail Glukhikh 760fb668bb Introduce FIR resolution API with lazy resolve to use in IDE
Now lazy resolve atomic element is a file (declaration-level resolve)
or a callable declaration (expression-level resolve)

#KT-24351 In Progress
2019-07-30 16:28:17 +03:00
Dmitry Savvinov aaf76a0e46 Enable TypeRefinement in COMPOSITE resolution mode 2019-07-30 12:41:41 +03:00
Dmitry Savvinov 2b4d70fcf0 [Resolve] Rewrite how built-ins are created
Under COMPOSITE mode we don't have a globally known way to create
built-ins, instead, we have to create them on per-module basis.

So, in this commit we:

1. Use builtInsProvider: (ModuleInfo) -> KotlinBuiltIns instead of
precomputed builtIns instance, in order to be able to calculate
builtIns on per-module basis

2. Introduce new entity, called BuiltInsCache, which, roughly
speaking, is a map of form ModuleInfo -> KotlinBuiltIns, to prevent
creation of multiple builtInsInstances
NB. Actually, it's of form BuiltInsCacheKey -> KotlinBuiltIns, because
we shouldn't create new builtIns for each module. Also, currently,
each platform has its own BuiltInsCacheKey implementation, because
parameters by which built-ins are created, are a bit different across
different platforms. Ideally, we should eliminate those differences
and they use one concrete implementation as a key.
2019-07-30 12:41:40 +03:00
Dmitry Savvinov 9f2a03947c [Resolve] Compute dependency on SDK properly
Under COMPOSITE resolution mode (see ResolutionModeComponent) we have
no fixed and globally known SDK, instead, for each module we have to
find SDK it it's transitive dependencies.

Currently, this is necessary in order to create proper JvmBuiltIns,
which need dependency on SDK to be present in immediate dependencies.
2019-07-30 12:41:40 +03:00
Dmitry Savvinov 02c07a4a6c [Resolve] Introduce an ability to get all moduleInfos without filtering by platform
Previously, each ProjectResolutionFacade was tied to the respective
platform, so there were no point in collection moduleInfos for all
possible platforms.

For composite resolution mode, we have to get all modules no matter
what their platform is (because all modules will be analyzed in one
facade), so this commit adds such an ability.
2019-07-30 12:41:40 +03:00
Dmitry Savvinov f9b8ab3a3a [Resolve] Introduce CompositeResolver
This commit introduces CompositeResolverForModuleFactory, which should
work under so-called "composite resolution mode", where sources of all
all modules are analyzed in one global facade.

This allows to:
- avoid re-analyzation of common sources
- avoid retaining memory for all platforms (which can be very bad as
soon as we'll start distinguishing various flavours of platforms,
especially "flavours" of common platform)
- support running platform-specific checks in common modules (e.g.,
report JVM_PLATFORM_DECLARATION_CLASH if common sources are going to have
it)
- support analysis of shared platform modules, like commonNative

This mode heavily depends on so-called "type refinement" support in the
compiler, which is introduced in other series of commits.

In this commit, CompositeResolver and related codepaths are left unused.
Also, this commit misses several important pieces of logic in
resolvers-setup code, which should be different for CompositeResolver
- computation of 'firstDependency'
- computation of built-ins
- computation of modules owned by facade

They will be covered in the following commits
2019-07-30 12:41:40 +03:00
Dmitry Savvinov adb0f5eaf9 [Resolve] Introduce CompositeAnalysisSettings
Because we want to support both COMPOSITE and SEPARATE resolution modes
at once, we have to leave 'globalFacadesPerPlatformAndSdk'-map, but in
COMPOSITE mode it should use less parameters for that map, and, in
particular, we shouldn't use Platform and SDK for equality.

This commit introduces separate instance which should be used in
COMPOSITE mode.

COMPOSITE mode itself will be introduced in the following commits.
2019-07-30 12:41:40 +03:00
Dmitry Savvinov 5e95890028 [Resolve] Introduce KotlinMultiplatformAnalysisModeComponent
Introduce a component which tells which resolution mode should be used.

COMPOSITE mode will analyze all sources for all platforms in one facade,
and will use proper support in the frontend instead of
CombinedModuleInfo.

SEPARATE mode is essentially a "legacy" mode, where each platform is
analyzed in separate facade (leading, in particular, to multiple
re-analyzation of common sources)

Facilities for support of COMPOSITE mode will be introduced in the
following commits.

resolution component
2019-07-30 12:41:40 +03:00
Dmitry Savvinov 90cf9daff3 [Resolve] Abstract creation of platform-specific package fragment providers 2019-07-30 12:41:40 +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 0f56d243cb [Resolve] Support test/production/dependsOn internal-visibility 2019-07-30 12:41:40 +03:00
Dmitry Savvinov 68c1a7cedd Use stable order for dependsOn and related diagnostics 2019-07-30 12:41:39 +03:00
Dmitry Savvinov 54cdd3bfef [Misc] Refactor Module.cached extension to accept lambda instead of FunctionalInterface 2019-07-30 12:41:39 +03:00
Denis Zharkov 01f0589ddf [Invariant Fix] Use the same lock inside single GlobalFacade
Before refinement, order of accessing compiler's entities (supertypes,
descriptors, memberscopes) was always the following:

    sources -> libraries -> SDK (built-ins)

With refinement, it is sometimes possible to inverse this order, e.g.
access sources after libraries or SDK. This mainly happens in the following
scenario:

- we reference some library/SDK class, but do not acquire source-lock
  This might seem a bit weird, but actually it is quite easy to achieve
  as soon as we understand that analysis sources doesn't necessarily
  acquires respective lock, only forcing lazy computations does so.
  E.g., we can just traverse PSI tree and meet some refernce to "Any?" -
  this doesn't involves acquiring source-lock

- we start resolving it, which usually involves acquiring library/SDK-lock
  (e.g., in order to get it supertypes or memberScope)

- because we reference it from the source-module, we may like to refine
  it, in which case we will have to acquire source-lock on refinement
  cache

Obviously, that may lead to deadlocks, so, in this commit we disable
creating granular locks when we work with refinement.

Note that if refinement is disabled (which is the case for all non-MPP
projects), we still create separate locks.
2019-07-30 12:41:39 +03:00
Dmitry Gridin 311cfc3806 UnimplementedKotlinInterfaceMemberAnnotator: shouldn't report methods with @JvmStatic
#KT-27208 Fixed
2019-07-23 16:23:04 +03:00
Dmitry Gridin cf07585b11 UnimplementedKotlinInterfaceMemberAnnotator: cleanup code 2019-07-23 16:23:03 +03:00
Dmitry Gridin 0993fb82fe multiplatformUtil: implementedModules shouldn't ignore android test module
Relates to #KT-30799
2019-07-22 17:56:25 +03:00
Vladimir Dolzhenko 0f6c381cd7 Fixed a corner case for invalidate package cache for default package
relates to KT-25264
2019-07-19 18:02:20 +02:00
Natalia Selezneva f6b03dc02f Add Show Kotlin Gradle DSL Logs Action (KT-31440)
Provide a label for this action in some script diagnostics from gradle dsl resolver
^KT-31440 Fixed
2019-07-19 12:06:09 +03:00
Vladimir Dolzhenko 022275b781 Do not invalidate package caches on generic events, KT-25264 2019-07-19 09:14:26 +02:00
Nikolay Krasko 484c4ca268 Try to postpone activating decompiler from light element equivalence 2019-07-18 22:10:20 +03:00
Nikolay Krasko 353ca9752f Better validity check for kotlin light element
There're exceptions from `isWritable` method in light classes caused by
accessing invalid elements.

Override KtLightMemberImpl implementation to avoid activating
decompiler during validity check.
2019-07-18 22:10:20 +03:00
Dmitriy Dolovov 10b79816ab Always analyze KTS with JVM platform
Issue #KT-29953
2019-07-17 22:37:37 +07:00
Dmitry Gridin b1e371a2dd MPP: don't return Main modules from implementedModules for Test modules
#KT-28529 Fixed
#KT-30799 Fixed
2019-07-16 17:08:42 +03:00
Igor Yakovlev cd6abcd4c9 Expect modifier definitions is not exposed by UL-classes 2019-07-12 16:33:52 +03:00
Igor Yakovlev afe784e79e Add UL-annotations support 2019-07-12 16:33:51 +03:00
Natalia Selezneva 4fed624942 Append for commit: switch ScriptReportSink to new scripting API
Commit hash e4d0c2cb0e
2019-07-12 16:24:57 +03:00
Dmitry Gridin f310bd3324 RemoveRedundantQualifierNameInspection: apply on idea module 2019-07-12 15:51:12 +03:00
Dmitry Gridin d47a7234bb ReplaceJavaStaticMethodWithKotlinAnalogInspection: apply inspection on idea module 2019-07-10 14:09:36 +03:00
Natalia Selezneva e4d0c2cb0e Scripts: switch ScriptReportSink to new scripting API
Use ScriptDiagnostic instead of ScripReport
2019-07-10 10:10:21 +03:00
Natalia Selezneva bd0f947222 Refactor script reports: introduce getter, check that report are changed inside attach method 2019-07-10 10:10:21 +03:00
Natalia Selezneva 7215e03a47 Scripts: rewrite search without usage of legacy script definition 2019-07-10 10:10:20 +03:00
Natalia Selezneva b0c9339dee Scripts: search for script definition using PsiFile instead of file name 2019-07-10 10:10:07 +03:00
Yan Zhulanow 6d7d524b9b Debugger: Fix 'expect fun' evaluation from common code (KT-26742) 2019-07-08 16:25:17 +09:00
Andrey Uskov 90187c959e Add test for 'isHMPP' flag 2019-07-02 22:41:02 +03:00
Nikolay Krasko 28a45909a0 Fix compatibility with 192 branch (KT-32364) 2019-07-02 14:00:24 +03:00
Nikolay Krasko ba2ca5ae3c Fallback to simple oocb when per-language trackers are disabled (KT-32364) 2019-07-02 14:00:11 +03:00
Nikolay Krasko f605d4e73b Revise per module out-of-code-block (KT-32364) 2019-07-02 13:59:35 +03:00
Nikolay Krasko 73eea6f4b6 Minor: rename file before refactoring 2019-07-02 13:59:21 +03:00
Nikolay Krasko 4f678c8289 Create project service with Kotlin trackers (KT-32364) 2019-07-02 13:59:19 +03:00