Commit Graph

4920 Commits

Author SHA1 Message Date
pyos cd47c11efd Generate unique parameter names in LocalDeclarationsLowering 2019-10-07 15:14:48 +02:00
Mikhael Bogdanov 13b69b730a Regenerate JS tests 2019-10-07 14:53:54 +02:00
Anton Bannykh aad9cbbf01 [JS IR BE] Fix tests failing due to reduced runtime 2019-10-04 17:30:45 +03:00
Georgy Bronnikov 4b5877f3b5 JVM_IR, codegen: handle names for classes within local classes 2019-10-03 17:11:48 +03:00
Svyatoslav Kuzmich 5d7f18b1b9 [JS] Support wrapped and dynamic types in typeOf 2019-10-03 13:12:46 +03:00
Dmitry Petrov a633a33627 KT-14513 Don't generate delegated property metadata when unused
If the delegated property operators involved are inline, and delegated
property metadata parameter is not used (which is often the case, e.g.,
'lazy'), we can skip those properties in metadata generation.

NOT implemented: special case when only 'kProperty.name' is used by the
corresponding delegated property operators.

Also a sneak fix for KT-34060.
2019-10-02 17:14:48 +04:00
Denis Zharkov e54d2c7c32 Support named arguments in their own position
^KT-7745 In Proggress
2019-10-02 11:13:15 +03:00
Alexander Gorshenev c227c13799 Commonizing klib metadata between native and js 2019-10-01 17:38:57 +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
Ilmir Usmanov 08794d17a0 Do not box function argument if it is used in EXACTLY_ONCE lambda
Since we cannot change type of parameter, we cannot replace it with
box type.
 #KT-29510 Fixed
 #KT-29614 Fixed
 #KT-29385 Fixed
2019-09-30 17:42:17 +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
Anton Bannykh b4917ec816 JS: remove unconditional as SimpleType cast
This is a workround for a bug introduced in the typeOf
support
2019-09-27 16:55:10 +03:00
Mark Punzalan c16b59191b Do not cache "last" value (i.e., size/length) in lowered for-loop
iteration over CharSequences.

CharSequences may be mutable (e.g., StringBuilder) and therefore its
contents and length can change within the loop.
2019-09-27 13:44:40 +02:00
Svyatoslav Kuzmich 7592048437 [JS] Support typeOf 2019-09-25 18:12:55 +03:00
Vyacheslav Gerasimov c1e1dbd83e Build: Fix usages of "java.home" for tools.jar dependency
#KT-33984
2019-09-25 17:54:18 +03:00
Ilmir Usmanov 06d0e8a521 JVM_IR: Support suspend functions with extension receivers 2019-09-19 19:28:10 +03:00
Ilmir Usmanov 2bfd17d8fb JVM_IR: Minor. Unmute test. 2019-09-19 19:28:08 +03:00
Ilmir Usmanov 587fcafc85 JVM_IR: Support continuation crossing inline lambda boundaries
I.E. generate fake continuation markers.
2019-09-19 19:28:03 +03:00
Steven Schäfer d8646e29b7 Add additional Result api test 2019-09-18 18:52:58 +02:00
Steven Schäfer b85b2d9af8 Add more tests for inline class equality 2019-09-18 18:52:58 +02:00
Dmitry Petrov 0531bd4fe6 KT-29229 Intrinsify 'in' operator for unsigned integer ranges
Support mixed type case, e.g., '[UByte] in [UIntRange]'.
2019-09-17 15:50:47 +03:00
Dmitry Petrov f3837e91e3 Add BE tests for 'break' and 'continue' inside 'when' 2019-09-12 15:11:01 +03:00
Roman Artemev e5a1040dbd [KLIB] Fix references to private top-level typealias via type abbreviation 2019-09-10 19:59:01 +03:00
Kristoffer Andersen e7d0909979 JVM_IR: Fix null-constant comparison with primitive types. 2019-09-09 10:23:11 +02:00
Mikhail Zarechenskiy e21da3a61a Avoid resolving array-set method several times
While origin problem was in NI, it's also nice to have this change in OI
 in order to slightly improve performance

 #KT-33125 Fixed
2019-09-09 11:04:18 +03:00
Mikhail Zarechenskiy f8449bf15a [NI] Clear partially resolved calls after resolve of top-level call
#KT-32433 Fixed
2019-09-09 11:04:17 +03:00
Steven Schäfer 62a1ea643a Add additional tests for bound receivers in callable references 2019-09-06 15:11:59 +02:00
Roman Artemev 0040298eac Fix master
- improve assertion message
 - compare correct file paths
 - fix C JS BE testData
2019-09-04 14:37:14 +03:00
Roman Artemev 3753b75609 [JS KLIB IC] Implement incremental cache for IR 2019-09-03 14:21:32 +03:00
Roman Artemev 90504c797a [IR SERIALIZATION] Add tests about klib linkage 2019-09-03 14:21:31 +03:00
Steven Schäfer 102a3d60e0 IR: Consistently copyAttributes in DeepCopyIrTreeWithSymbols
This was missing for IrFunctionReferences, which caused problems when
copying default parameters before CallableReferenceLowering in the
JVM_IR backend.
2019-09-02 19:55:36 +02:00
Svyatoslav Kuzmich 9594e9b3b1 [JS IR BE] Initial export generation 2019-08-30 13:15:37 +03:00
Zalim Bashorov 21b2487290 Minor: add an additional message for further investigation EA-141821 2019-08-27 18:19:18 +03:00
Alexander Udalov d59f2bcc80 Fix KotlinReflectionInternalError on invoking callBy with defaults in supertypes
There are two parts in this change:

1) Previously, we looked up $default methods with the incorrect
   signature in supertypes. For example in defaultInSuperClass.kt, we'd
   try to find a method foo$default with the signature `(B, String,
   String, int, Object)` in the class A. Now we're modifying the array
   of parameter types on each step if we're looking for a static
   $default method, by assigning its first element to be the containing
   class. This fixes cases when defaults come from a superclass.
2) For interfaces, $default methods are actually located in the
   corresponding DefaultImpls class. Now we look up that class and
   search for the $default method there. Note that this is needed
   because of KT-33430. This fixes cases when defaults come from a
   superinterface.

 #KT-13936 Fixed
2019-08-22 18:04:00 +02:00
Alexander Udalov cb2e68fece JVM IR: skip temporary variables in InventNamesForLocalClasses 2019-08-22 18:04:00 +02:00
Ilmir Usmanov f9506db20a Ignore sources which are not LOADs in refinedIntTypeAnalysis
#KT-33414 Fixed
2019-08-22 16:08:08 +03:00
Svyatoslav Kuzmich 6e6ffa12a6 [WASM] Initial infrastructure
- New module ":compiler:backend.wasm"
    - Initial compiler infra (driver, phaser, context)
    - Subset of Wasm AST
    - Skeleton of IR -> Wasm AST
    - Wasm AST -> WAT transformer

- Testing infra

- SpiderMonkey jsshell tool
2019-08-22 15:59:54 +03:00
Mikhail Zarechenskiy d59b910403 Add tests for obsolete issues
#KT-32207 Obsolete
 #KT-32836 Obsolete
 #KT-32949 Obsolete
 #KT-9384 Obsolete
2019-08-15 13:01:39 +03:00
Alexander Udalov b970a57adb Generate version requirement on inline functions since API version 1.4
The old compiler will crash if it tries to inline a function that's
passing a lambda parameter into the new parameter null check method
`Intrinsics.checkNotNullParameter` because that usage is not considered as
inlinable by the old compiler (it only knows about
`Intrinsics.checkParameterIsNotNull`). Therefore we require that these
functions can only be read by compilers of version 1.3.50 or greater.

 #KT-22275 Fixed
2019-08-12 16:09:23 +02: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
Ilmir Usmanov e88dce3e19 Use CFG to recognize suspension point's end
Previously it was linear scan, failing on unbalanced suspension markers.
Now, I use CFG to find end markers, which are reachable from start
markers. Using CFG allows to walk through suspension point instructions
only, since they form region.
If, for some reason, end marker does not exist (inliner or unreachable
code elimination pass remove unreachable code) or is unreachable,
just ignore the whole suspension point, as before.
 #KT-33172 Fixed
 #KT-28507 Fixed
2019-08-09 21:05:03 +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
Roman Artemev 46b98a1e98 [JS BE] Make sourceMap generation more precise
- Don't produce mapping for closing bracket in case of expressionBody
 - Map Kt*Function declaration into corresponding js fun declaration
 - Update test data & add new test
2019-07-24 18:56:40 +03:00
Mikhael Bogdanov 74e49d91ca Proper implement 'classForImplicitThis' 2019-07-22 10:35:03 +02:00
Roman Artemev af45e1c5dc [JS BE] Do not produce source mapping for fake KtElement
Fix [KT-26701], [KT-12935]
2019-07-17 10:21:34 +03:00
Alexander Udalov f38e4d618e Support Array::class literal, forbid Array<X>::class on non-JVM
#KT-31230 Fixed
2019-07-16 15:57:26 +02:00
Mark Punzalan de1e27c584 Make all progression headers inclusive, and decrement last for
last-exclusive progressions (i.e., "until" progressions and loop over
array indices).

This change makes it possible to correctly implement the handling of
"step" progressions. Computing the last element of a stepped progression
requires that the last is inclusive.

Also invert the while loop (into if + do-while) that is used when
lowering for-loops over progressions that cannot overflow. This keeps
the performance characteristics closer to the ForLoopsLowering in
kotlin-native, since the goal is to converge to this shared version.

Also used IrType instead of KotlinType, where possible.

 https://github.com/JetBrains/kotlin/pull/2390
 https://github.com/JetBrains/kotlin/pull/2305
2019-07-16 14:08:21 +02:00
Jake Wharton 4386518c4d Add intrinsic for ULong/UInt.toString on Java 8+
Unfortunately this cannot currently be done for the extension overload which accepts a radix due to behavior difference with regard to invalid radix values.
2019-07-16 11:15:19 +02:00
Roman Artemev efafb6585e [JS IR BE] Refactored js("...") function
- support object expression
 - do not wrap in function in statement-level position
 - support implicit return
 - code clean up
2019-07-11 18:00:28 +03:00