Commit Graph

9409 Commits

Author SHA1 Message Date
Alexander Udalov 3f1533c35b Restore support for local class literals in annotation arguments
This was broken in c1ab08c8ce where we started to represent KClassValue
as a ClassId of the referenced class + number of times it's been wrapped
into kotlin.Array. Local classes do not have a sane ClassId, so in this
change we restore the old behavior by representing KClassValue with a
sealed class value instead

 #KT-29891 Fixed
2019-02-25 19:22:09 +01:00
Yan Zhulanow 24cdd3f857 Remove 'debugTypeInfo' key
The key became obsolete as the new evaluator doesn't use it anymore.
2019-02-25 14:43:57 +03:00
Yan Zhulanow 227a7e5609 Provide access to 'coroutineContext' inside suspend functions/lambdas (KT-24829) 2019-02-25 14:43:54 +03:00
Yan Zhulanow e8c066605b Do not drop analysis results for the code fragment context, allow to re-use it
Otherwise labels declared in the expression context become unresolved.
This is needed for the `this@label` expression evaluation support (KT-28134).
2019-02-25 14:43:53 +03:00
Dmitry Savvinov 50d1c013fc Force-resolve body in contract computation under lock
Even though acquire/release pattern guarantees memory visibility across
threads, it doesn't prevents concurrent access to critical section (i.e.
to force-resolve of the corresponding body).

This can lead to multiple resolution passes over one and the same PSI in
IDE, which, in turn, leads to 'rewrite at slice'-exceptions. See
KT-30030 for case description and details.

^KT-30030 Fixed
2019-02-25 11:10:16 +03:00
Dmitry Savvinov 705ec503cf Minor optimization: don't put 'null' for ContractProvider in user data 2019-02-25 11:10:16 +03:00
Mikhail Zarechenskiy 617bed1bf1 Fix nested typealiases expansion and as a result fix serialization
Consider the following situation:
 ```
 class Inv<T>
 typealias A<K> = Inv<K>
 typealias B<V> = Inv<A<K>>

 fun <U> materialize(): B<U> = TODO()
 ```

 Type `B<U>` is expanding to `Inv<Inv<U>>` and for this type `B<U>` and
 `Inv<A<U>>` are abbreviated types, but due to a bug we forgot to make
 substitution for `Inv<A<U>>` and were getting abbreviated type
 `Inv<A<K>>` where `K` is a type parameter from the typealias declaration.

 This bug didn't affect subtyping anyhow but the incorrect type was
 serialized and caused problems during deserialization as there wasn't
 `K` in deserialization context.

 #KT-24964 Fixed
 #KT-20780 Fixed
 #KT-20065 Fixed
 #KT-28236 Fixed
 #KT-21775 Fixed
2019-02-25 00:28:45 +03:00
Dmitriy Novozhilov 677987c85f Add diagnostics on annotations on super types. KT-23992 fixed 2019-02-22 10:28:21 +03:00
Dmitriy Novozhilov 92bd907983 Fix checking repeatablilty of use-site target annotations. KT-26638 fixed 2019-02-22 10:15:37 +03:00
Dmitriy Novozhilov 3e147af3c0 KT-27565 fix 2019-02-22 10:15:16 +03:00
Ilya Chernikov d1a1594f26 Remove redundant direct usages of the ScriptDefinition in compiler
plus some refactoring around definition extraction
2019-02-21 15:59:48 +01:00
Ilya Chernikov cc4aedb807 Move the rest of script descriptor implementation details to plugin, cleanup 2019-02-21 15:59:48 +01:00
Ilya Chernikov 29fa0f5dff Replace unnecessary direct usages of the LazyScriptDescriptor with ScriptDescriptor interface
lift result property to the interface to implement it
2019-02-21 15:59:48 +01:00
Ilya Chernikov e28017039d Split scripts and class/object declarations in DeclarationsProvider
simplifies code in most places, avoids filtering in places where they
should be processed independently
2019-02-21 15:59:48 +01:00
Ilya Chernikov a218455193 Extract script descriptor creation to scripting plugin 2019-02-21 15:59:48 +01:00
Ilya Chernikov 4359919e10 Add package-level class descriptors generation to the SyntheticResolveExtension
required for extracting script descriptors generation to an extension
2019-02-21 15:59:48 +01:00
Ilya Chernikov 0839b44ebb Replace explicit ScriptDescriptor in resolver with appropriate superclass 2019-02-21 15:59:47 +01:00
Dmitriy Novozhilov f186c83b15 KT-25383 fix 2019-02-21 12:04:23 +03:00
Natalia Selezneva 254374c619 Use ModuleInfo in VirtualFileFinder to add script dependencies in search scope
Otherwise it prevent to inline functions from those dependencies during scratch compilation
2019-02-20 18:36:38 +03:00
Dmitriy Novozhilov 5d0074bda5 Fix bug in try/catch resolution in NI
Bug was presented in a236ad5
2019-02-18 12:43:42 +03:00
Dmitriy Novozhilov 49a42f9434 Fix #KT-28999. Prohibit type parameters on anonymous objects 2019-02-17 13:02:22 +03:00
Dmitriy Novozhilov 4a298d1413 NI: introduce new data flow analysis for try/catch (#KT-28370) 2019-02-17 12:51:25 +03:00
Dmitriy Novozhilov a236ad5686 NI: resolve try catch as synthetic function call (#KT-25435 fixed) 2019-02-17 12:46:11 +03:00
Dmitriy Novozhilov 8d3271cc68 Refactor if expressions resolving
Context without expected type became redundant after synthetic
  call resolving was added for inference of `if` expression type

`isStatement` flag removed, because it was effectively unused
2019-02-17 12:46:11 +03:00
Dmitriy Novozhilov 1a1375240b Minor: reformat PSICallResolver according to codestyle 2019-02-17 12:46:11 +03:00
Alexander Udalov b2cdf2dc74 Simplify AnnotationSplitter creation and target set computation 2019-02-15 17:53:27 +01:00
Alexander Udalov 4692247897 Do not check backing field presence in AnnotationSplitter
This code can be invoked early, during body resolution and before the
fact that a property has backing field (which is only known for certain
after body resolution, because an implicit 'field' identifier may be
used). Since split annotations are cached until the end of the program,
they may end up on incorrect elements in the bytecode (or disappear
completely) as in KT-29507 or KT-28182.

Because the FIELD target has the lowest priority among implicit
annotation targets (see TARGET_PRIORITIES), it's safe to always assume
that FIELD is a valid target when splitting annotations. This only
changes the way annotations are split in case of incorrect code, as
changes in test data show.

 #KT-28182 Fixed
 #KT-29507 Fixed
2019-02-15 17:53:27 +01:00
Anton Bannykh 3529114913 JS: incremental translation of tests and main fun invocation 2019-02-14 15:14:28 +03:00
Toshiaki Kameyama d583c1be58 Can be replaced with binary operator: do not suggest when receiver or argument is floating point type
#KT-28596 Fixed
2019-02-14 15:10:26 +03:00
victor.petukhov 30762a450a Wrap diagnostic parameters to double quotes and split by comma instead of semicolon 2019-02-14 12:31:42 +03:00
victor.petukhov 46bd5ba107 Add alphabetical sorting diagnostics with same ranges 2019-02-14 12:31:42 +03:00
victor.petukhov b354518a41 Add lazy debug diagnostic DEBUG_INFO_EXPRESSION_TYPE 2019-02-14 12:31:42 +03:00
victor.petukhov f92232f015 Decompose and rewrite CheckerTestUtil to Kotlin 2019-02-14 12:31:42 +03:00
victor.petukhov 9e06e1eec0 Move and rename into .kt files around CheckerTestUtil for rewrite to Kotlin 2019-02-14 12:31:42 +03:00
Denis Zharkov abad408d7b Do not implicitly propagate deprecations originated in Java
^KT-29604 Fixed
2019-02-13 16:21:05 +03:00
Ilya Chernikov 89fc7eba95 Make script infrastructure providers optional 2019-02-10 13:31:56 +01:00
Dmitriy Novozhilov 9129210cfe Move changes from dfb379d under new language feature (#KT-28672)
Changes from that commit are breaking, and should be pass throw LC
2019-02-07 12:12:34 +03:00
Dmitriy Novozhilov b9c5b63d69 Fix #KT-28993 2019-02-07 12:12:34 +03:00
Mikhail Glukhikh db2fb86c8e Raw FIR: implement expression trees & conversions from PSI
Testing: total kotlin test controls no stubs in FIR in non-stub-mode
#KT-29002 Fixed
2019-02-06 11:58:59 +03:00
Dmitriy Novozhilov dfb379d999 Expand Effect System with receiver values (#KT-28672)
Add some classes to hierarchy of `ESValue`:
- `ESReceiver` -- representation of receiver
  of lambda function
- `ESDataFlow` and `ESDataFlowReceiver` -- little refactoring of entities
  that holds information for DFA (description in comments in code).

Also add kdoc to classes of `ESValue` hierarchy
2019-01-31 17:25:13 +03:00
Dmitriy Novozhilov b86ea7621c Cleanup code in PseudocodeTraverser 2019-01-31 17:25:13 +03:00
Dmitriy Novozhilov 0e8c43f8c0 Generify key type parameter of ControlFlowInfo
Previously only `VariableDescriptor` was key of `ControlFlowInfo`.
Now it's generic parameter `K: Any`, so there is a possibility of using
  different object's inside CFA
2019-01-31 17:25:13 +03:00
Dmitriy Novozhilov efe891bb47 Remove duplicate of typealiases for javaslang collections 2019-01-31 17:25:13 +03:00
Dmitriy Novozhilov 68d2cbf91f Extract classes used in control flow analysis of variable into variable package 2019-01-31 17:25:13 +03:00
Dmitriy Novozhilov 1dd7365e9f Reformat some classes in org.jetbrains.kotlin.cfg according to code style 2019-01-31 17:25:13 +03:00
Dmitriy Novozhilov fa79f7bf30 Reformat ControlFlowProcessor according to code style 2019-01-31 17:25:13 +03:00
Dmitriy Novozhilov 68d7e51d32 Support test directive for rendering full diagnostic messages
New `RENDER_DIAGNOSTICS_MESSAGES` directive forces test system render
full messages for all diagnostics that found in test file
2019-01-31 17:25:13 +03:00
Dmitriy Novozhilov 047f9abaf7 Make order of rendered diagnostics more stable
There was a bug that sometimes diagnostics on the same element with
same names but with different parameters had been reshuffled.
2019-01-31 17:25:13 +03:00
Mikhael Bogdanov a122cba862 Switch Kotlin project to jvm-target 1.8
#KT-29405
2019-01-31 07:43:05 +01:00
Mikhail Zarechenskiy 6705803d83 [NI] Fix coercion to Unit for lambdas with empty labeled return 2019-01-30 14:56:31 +03:00