Commit Graph

26820 Commits

Author SHA1 Message Date
Mikhail Glukhikh b3056b8bf5 FIR resolve: implement JVM K/J type mapping
Declared member scopes are now wrapped in JvmMappedScope
2019-11-28 13:18:10 +03:00
Mikhael Bogdanov 742c3a228a JVM_IR. Proper lower toArray functions 2019-11-28 08:31:15 +01:00
Georgy Bronnikov 1ed23d7c54 IR: reorganize IrProvider handling
Make DeclarationStubGenerator a subclass of IrProvider,
anticipating deserialization of IR structures for JVM_IR backend.
2019-11-27 20:02:27 +03:00
Dmitriy Novozhilov e38fdae1bc Regenerate DiagnosticsTestWithJsStdLibGenerated 2019-11-27 18:03:05 +03:00
Dmitriy Novozhilov 5190ff9733 [FIR-TEST] Add test with SAM conversion in constructor call 2019-11-27 18:01:20 +03:00
Dmitriy Novozhilov 71acd42727 [FIR-TEST] Add test with ambiguity produced by definitely not null types 2019-11-27 18:01:20 +03:00
Simon Ogorodnik d59a171b65 [FIR] Fix isMyTypeVariable in ConeInferenceContext 2019-11-27 17:15:07 +03:00
victor.petukhov dbacae94d0 Fix common super type calculation for captured dynamic types
^KT-32499 Fixed
2019-11-27 15:48:00 +03:00
Dmitriy Novozhilov 567248ebd7 [FIR] Add default upper bounds to type parameter of synthetic when and try calls 2019-11-27 15:00:03 +03:00
Dmitriy Novozhilov 5770d19d61 [FIR] Fix calculating of completion mode 2019-11-27 15:00:03 +03:00
Dmitriy Novozhilov 9c3117ba40 [FIR] Git rid of creating new when and try fir nodes
It's necessary because of before change we safe original `when`
  without infered type as return statement of lambda and after that
  we add incorrect constraint system from it to outer call
2019-11-27 15:00:03 +03:00
Dmitriy Novozhilov 8085ec8b0b [FIR-TEST] Add test with ambiguity between java field and java accessor 2019-11-27 15:00:03 +03:00
Dmitriy Novozhilov 3c661dd142 [FIR-TEST] Add test with unresolved invoke of lambda with receiver 2019-11-27 15:00:03 +03:00
Dmitriy Novozhilov 96d3a06129 [FIR-TEST] Add test with hiding local functions 2019-11-27 15:00:03 +03:00
Dmitriy Novozhilov 5d14c76f70 [FIR-TEST] Add test with unresolved Array<T>.clone() 2019-11-27 15:00:02 +03:00
Dmitriy Novozhilov 4059fae1b7 [FIR-TEST] Add test with type mismatch on receiver with captured type 2019-11-27 15:00:02 +03:00
Dmitriy Novozhilov 572256e2eb [FIR-TEST] Add test with not-working bound smartcast 2019-11-27 15:00:02 +03:00
Mark Punzalan 1a2e09e6a5 ForLoopsLowering: Handle Iterable.withIndex() where the type is a
bounded type parameter.

TODO: Handle Sequences by extending DefaultIterableHandler.
2019-11-27 10:59:34 +01:00
Denis Zharkov 00a70c51f0 FIR: Generate fake overrides always if there are type parameters
See the comment
2019-11-27 11:20:52 +03:00
Denis Zharkov 8efd59403d FIR: Avoid redundant substitution when type parameters don't change 2019-11-27 11:20:52 +03:00
Denis Zharkov 07a4352809 FIR: Add hack for Fir2IrVisitor
See the comment
2019-11-27 11:20:52 +03:00
Denis Zharkov 3b7ad066fc FIR: Substitute type alias constructors properly 2019-11-27 11:20:52 +03:00
Denis Zharkov f68929fe74 FIR: Leave functions type parameters in subsituting scope 2019-11-27 11:20:52 +03:00
Denis Zharkov b5ef063b0f FIR: Cache functions in use-site member scope 2019-11-27 11:20:52 +03:00
Denis Zharkov f659dc0bea FIR: Add synthetic values/valueOf methods to Java classes 2019-11-27 11:20:52 +03:00
Denis Zharkov 256f5ca0a1 FIR: Support inherited default parameters 2019-11-27 11:20:52 +03:00
Mads Ager 8d5e5210a6 JVM_IR: Copy annotations to suspend function views. 2019-11-26 21:00:50 +03:00
Leonid Startsev ed786c4daf Enable compiler plugins in JS IR backend (and WASM too, since they use same loadIr function) 2019-11-26 19:34:48 +03:00
Jiaxiang Chen 0441e484a6 PSI2IR: For implicit function return, use expression's end offset as start offset of the IrReturn to generarate correct line number. 2019-11-26 17:59:28 +03:00
Jiaxiang Chen e49431a12c Debug information test: make stepping information more readable. 2019-11-26 17:59:28 +03:00
Jiaxiang Chen 331b085b2f JVM_IR: Fix line number for catch clause. 2019-11-26 17:59:28 +03:00
Jiaxiang Chen 3ea878b1c6 JVM_IR: Fix line number for varible initializer 2019-11-26 17:59:28 +03:00
Nikolay Krasko 5d6333f0f4 193: Better services registration for parser tests 2019-11-26 15:39:27 +03:00
Leonid Startsev 3d2800f99b Move out symbols that do not depend on a BackendContext to a separate BuiltinSymbolsBase class.
The goal was to be able to use such symbols before BackendContext is even created – in psi2ir postprocessing step (i.e., IR compiler plugins).

Remove old code from serialization ir plugin.
2019-11-26 15:26:35 +03:00
Leonid Startsev 3e18350a1f Rewrite IR plugin infrastructure (and serialization plugin) so it won't emit LazyIR.
LazyIR was emitted because plugin was not able to declare symbols, only to reference them.
Moreover, declarations added by frontend plugin were also unbound symbols produced by psi2ir,
and declaration stub generator was stubbing them with LazyIR – therefore access to global symbol table is not enough for plugins. IrProvider won't help here, because some functions produced by plugin have circular dependencies.

By moving compiler plugins step between psi2ir and declaration stub generator, both problems are resolved
– unbound symbols produced by psi2ir and compiler plugins are declared where they would be declared if this was a user code,
and only unbound symbols left are external dependencies, which is a correct input for lazy ir.
2019-11-26 15:26:28 +03:00
Anton Bannykh 9fec2c78d1 JS IR: apply forLoopsLowering
Replaced createTemporaryVariable usages with createTmpVariables.
The latter doesn't rely on KotlinType's. Using KotlinType with
JS_IR backend causes runtime excpetions, as some expected descriptor
API is not implemented, because it avoids descriptors as much as
possible.
2019-11-26 15:08:10 +03:00
Jiaxiang Chen 0ea407fef9 debug information test: handle vm resume correctly. 2019-11-26 14:52:58 +03:00
Mikhail Glukhikh 178dbd3c5d Remove hacky re-initialization of PsiSubstitutor.KEY (branch 193)
After IDEA commit
https://github.com/JetBrains/intellij-community/commit/8b0af117241a074f5681fa93be74c6f1812497ba#diff-9b39aafa0a7b8d4f089100f3968931d0
this re-initialization is no more necessary. Moreover, it's harmful,
because this KEY is used as a map key in IDEA code,
and we cannot find information stored by this key.
This was a hidden reason of FIR / IR test failures in branch 193.

After this commit, FIR / IR tests in branch 193 should be fixed
2019-11-26 13:13:48 +03:00
Anton Bannykh 81699299f5 JS_IR: DCE
Could be enabled by toggling `-Xir-dce`

Box test output in js/js.translator/testData/out-min
2019-11-26 12:20:39 +03:00
Pavel Kirpichenkov cf82efb49f [NI] Add missing diagnostic on callable references in fake calls
Unresolved reference diagnositc was not reported on callable references
returned from if or when expression because of additional block wrapper.

^KT-30953 Fixed
2019-11-26 11:02:25 +03:00
Mikhail Zarechenskiy eb73650209 Fix race in IDE: inject proper storage manager for type parameters
With NO_LOCKS strategy we can easily end up in a situation when
 constraint system for a generic call is built incorrectly,
 producing flaky errors (or don't produce errors at all)

 Now proper storage manager is injected for all cases except:
 - IR
 - Codegen
 - Serialization plugin
 - Fake local objects

 Most likely, NO_LOCKS strategy for these cases is fine as at that point
 the compiler works in one thread

 #KT-34786 Fixed
2019-11-26 10:52:45 +03:00
Mads Ager 399667a434 JVM_IR: Implement data class array member intrinsics. 2019-11-25 19:00:31 +01:00
Svyatoslav Kuzmich ea8ade0852 [JS] Refactor and comment for typeOf fix 2019-11-25 20:25:03 +03:00
Svyatoslav Kuzmich 600fb723f4 [JS] Fix typeOf for some reified type parameters
Fix getting kType metadata in cases when corresponding jsClass value
is passed through temporary variable.
This can happen when jsClass expression is not consided trivial by
local variable optimizer. This happens for object declarations from
different modules, for example kotlin.Unit
2019-11-25 20:25:02 +03:00
Roman Artemev c4d993d14c [KLIB] Fix top level property index. Include const properties as well. 2019-11-25 20:22:04 +03:00
Roman Artemev 1e4f8b2946 [JS IR] Do not forbid typeOf inlining if it is not required 2019-11-25 20:22:03 +03:00
Roman Artemev 2e22ddba39 [JS IR] Fix annotation constructor body generation 2019-11-25 20:22:03 +03:00
Roman Artemev c5e25a0382 [JS IR] Make PrivateMembersLowering global to handle inlined private references correctly
- Fixes [KT-33334]
2019-11-25 20:22:03 +03:00
Roman Artemev 9946feb66c [JS IR] Fix name clash between class members defined on prototype
- Fixes [KT-33327]
2019-11-25 20:22:03 +03:00
Mads Ager 98ceee784a JVM_IR: More special bridge rewriting.
If there is an existing method that will have its argument types
remapped to boxed types, make sure to reflect that in the IR so
that code will be generated for a boxed value instead of a
primitive value.
2019-11-25 17:37:57 +03:00