Commit Graph

6615 Commits

Author SHA1 Message Date
Anton Bannykh 2fb7b01320 Fix capturing variables declared via destructuring (#KT-14535 fixed). 2016-11-01 14:00:24 +03:00
Anton Bannykh 6a1b0b9cbc withNonLocalReturn.kt was disabled for a wrong reason; reported the actual issue and fixed the comment 2016-10-27 17:27:03 +03:00
Anton Bannykh 7ee3baa020 Replaced when appropriate 'TARGET_BACKEND: JVM' -> 'IGNORE_BACKEND: JS'. Enabled some succesfully working decompiledText tests. 2016-10-27 14:17:25 +03:00
Alexander Udalov 455fef90c0 Fix codefen test case by adding stdlib 2016-10-27 10:44:33 +03:00
Anton Bannykh a3566174d6 Support destructuring in lambda parameters (KT-14422) and skipping some components in a destructuring declaration (KT-14507). 2016-10-26 18:29:13 +03:00
Ilya Gorbunov 98f7c61333 Reuse JVM box tests for binary operations in JS, excluding those that can't pass now. 2016-10-26 16:36:09 +03:00
Ilya Gorbunov 62fb47d137 Introduce bitwise operations and/or/xor/inv for Byte and Short. #KT-13554
Annotate new bitwise operations with SinceKotlin.
2016-10-26 16:35:46 +03:00
Michael Bogdanov eaf9c2e8b0 Fix for KT-13890: IllegalAccessError when invoking protected method with default arguments
#KT-13890 Fixed
2016-10-26 12:13:20 +03:00
Michael Bogdanov 1e59161e8f Fix for KT-14201: UnsupportedOperationException: Don't know how to generate outer expression for anonymous object with invoke and non-trivial closure
#KT-14201 Fixed
2016-10-26 12:13:19 +03:00
Alexander Udalov 035d6156a7 Drop Cloneable in JS, synthesize it at compile-time on JVM
Use the same approach that is used for creating function type classes
(Function{0,1,...}) + add Cloneable to supertypes of Array and primitive arrays

 #KT-5537 Fixed
2016-10-25 15:42:33 +03:00
Denis Zharkov b7e8071a7d Do not use BasicInterpreter for bytecode analysis
The problem with BasicInterpreter is the following:
it creates BasicValue objects that should be replaced in favor of StrictBasicicValue

See commit message in 25c6ac1 for clarification

 #KT-14447 Fixed
2016-10-25 10:14:52 +03:00
Denis Zharkov 3a197e8d7e Fix NPE caused by nullability checks optimizations
Mostly this commit replaces instances of original BasicValue from ASM
with ones of StrictBasicValue having strict equals implementation

Optimization issue was related to non-symmetric 'equals':
- NotNullBasicValue("java/lang/Object").equals(BasicValue("java/lang/Object")) == false
- BasicValue("java/lang/Object").equals(NotNullBasicValue("java/lang/Object")) == true

 #KT-14242 Fixed
2016-10-25 10:14:52 +03:00
Denis Zharkov a9fcee098d Support single-underscore named variables in JVM backend
There are mainly two kind of changes:
- skipping 'componentX' calls for destructuring entries named _
- fixing local variable table for them
 - skip entries for destructuring entries named _
 - use $noName_<i> format for lambda parameters named _

 #KT-3824 Fixed
 #KT-2783 Fixed
2016-10-24 10:19:25 +03:00
Dmitry Petrov c41ec1ddfb KT-14400: Properly handle TypeAliasConstructorDescriptor in KotlinTypeMapper.mapToCallableMethod(...)
Implement getDefaultType() in TypeAliasDescriptor subclasses.
2016-10-20 09:56:03 +03:00
Denis Zharkov 4793f71da2 Properly generate indices for destructured parameters in inline case
#KT-14399 Fixed
2016-10-19 16:05:50 +03:00
Dmitry Petrov a5d6559056 KT-14360 Microoptimizations in RedundantCoercionToUnitTransformer 2016-10-17 10:13:03 +03:00
Dmitry Petrov ac675784c1 KT-14357 Run RedundantCoercionToUnitTransformer before DeadCodeEliminatingMethodTransformer.
Remove empty try-catch blocks in DeadCodeEliminatingMethodTransformer.
2016-10-17 10:10:46 +03:00
Nikolay Krasko 87b628a3f7 Generate 'nop' instruction on lambda call when everything on line is going to be eliminated by inliner (KT-6477)
(cherry picked from commit 462bdb2)

 #KT-6477 Fixed
2016-10-14 14:52:06 +03:00
Michael Bogdanov 050139220d Fix for KT-14330 java.lang.IllegalArgumentException: Parameter specified as non-null is null: method ... parameter value
#KT-14330 Fixed
2016-10-14 10:56:15 +03:00
Dmitry Petrov 8d634f6003 KT-14274: resolve type alias constructors calls in supertypes list as type alias constructors.
Support @Deprecated for type aliases, including type alias constructors.
2016-10-13 17:52:21 +03:00
Dmitry Petrov 3d0288ffed Annotations on type aliases: generate synthetic method for type alias annotations. 2016-10-13 17:52:21 +03:00
Vsevolod e788ef408f KT-5044 code cleanup, test added 2016-10-13 10:11:32 +03:00
Vsevolod bd6f83b9b7 KT-5044 intrinsify all contains calls for primitive ranges from stdlib 2016-10-13 10:11:32 +03:00
Vsevolod d7ad27ac3b KT-5044 implement missing Range#contains tests and move it to separate package 2016-10-13 10:11:32 +03:00
Valentin Kipyatkov 41ee06ec96 Use parameter names in DescriptorRenderer 2016-10-11 23:38:49 +03:00
Denis Zharkov 194853b5c2 Fix backend issue related to JvmStatic val with accessor
Do not treat accessors to JvmStatic properties as having dispatch receiver

 #KT-11585 Fixed
2016-10-11 12:22:03 +03:00
Michael Bogdanov 5bd045c79c Fix for KT-14243: Wrong invocation descriptor on calling implicitly generated implementation in class
#KT-14243 Fixed
2016-10-10 14:17:50 +03:00
Alexey Andreev 977fd8f591 KT-12707: support case when secondary super constructor has optional parameters 2016-10-10 11:21:45 +03:00
Alexey Andreev c1b8e50734 KT-12707: (JS) proper translation of a constructor in subclass that calls secondary constructor of parent class. Fix #KT-12707 2016-10-10 11:21:45 +03:00
Denis Zharkov 0905bf3e38 Refine redundant null checks interpreter
The main change here is addition of a check that NotNullBasicValue instances
are not being created for non-reference types

Exactly this change should be used instead of f25f0db10e
The latter commit lead to problem described in the KT-14242 issue:
v.getType().getSort() == w.getType().getSort() && (v.getType().getSort() != Type.OBJECT || v.equals(w))

Problem is that the condition above returns true without calling `v.equals(w)`,
because the sort of type is ARRAY, not OBJECT, so testArray was being treated
as NotNullable erroneously

So the second part of this change is effectively revering mentioned commit

 #KT-14242 Fixed
2016-10-10 10:44:11 +03:00
Alexey Andreev 1dcb037aee KT-2752: remove diagnostic that reports about overridden method having several names from different sources. Generate proxies instead. Fix reporting name clash when two distinct fake overrides require same name. 2016-10-08 19:25:35 +03:00
Alexey Andreev c5087779e4 KT-2752: add diagnostics that reports about conflicting overridden declarations 2016-10-08 19:25:34 +03:00
Denis Zharkov dfb9b323ff Avoid generation of redundant abstract special stubs
#KT-13698 Fixed
2016-10-07 11:59:15 +03:00
Denis Zharkov 6e838f0adc Avoid generation of redundant toArray stubs
#KT-13698 In Progress
2016-10-07 11:59:15 +03:00
Denis Zharkov e05e0ec921 Optimize method count for collection stubs
Do not generate stubs if they're already present in superclasses

 #KT-13698 In Progress
2016-10-07 11:59:15 +03:00
Denis Zharkov 900c442efd Write generic signature for autogenerated toArray
#KT-14195 Fixed
2016-10-07 11:59:15 +03:00
Denis Zharkov 3a100d4139 Improve exception message in collection stubs 2016-10-07 11:59:15 +03:00
Denis Zharkov 8ee568105c Do not generate collection stubs for Kotlin-specific signatures
#KT-14188 Fixed
2016-10-07 11:59:15 +03:00
Alexander Udalov 73652f309f Do not create synthesized equals/hashCode/toString in data classes in compatibility mode
To simplify migration from 1.0 to 1.1, do not allow data classes to
automatically implement abstract equals/hashCode/toString declared in
super-interfaces (KT-11306) if "-language-version 1.0" is specified
2016-10-04 10:24:41 +03:00
Michael Bogdanov 95a1c254e1 Added error diagnostic on inheriting target 6 interface 2016-10-03 14:13:17 +03:00
Michael Bogdanov d9bb519b76 Don't generate delegation to jvm8 default methods 2016-10-03 14:06:01 +03:00
Michael Bogdanov c19e035f91 Properly map super calls in typeMapper 2016-10-03 14:06:00 +03:00
Michael Bogdanov 5f1f4a067d Map proper owner for method with default args 2016-10-03 14:06:00 +03:00
Michael Bogdanov dd4d5e3aa1 Generate 'DefaultImpls' for jvm 8 target only within compiler option 2016-10-03 14:05:59 +03:00
Michael Bogdanov ca41f01468 Generate interface property annotations in interface class (not in DefaultImpls) 2016-10-03 13:50:12 +03:00
Michael Bogdanov dfd5be1a33 Generate all bodies in interfaces as default methods 2016-10-03 13:50:11 +03:00
Dmitry Petrov 06101dba52 KT-13961 REDECLARATION not reported on private-in-file 'foo' vs public 'foo' in different file
Private-in-file declarations conflict with public overload-equivalent declarations
in other files in the same package.

Move functions for grouping possible redeclarations to OverloadResolver
(since they are used only there).

Refactor redeclarations / conflicting overloads reporting.
2016-10-03 11:50:29 +03:00
Alexander Udalov 74d6ef73d4 Prevent double initialization in codegen tests, fix ScriptGenTest#testDependentScripts
Add an assertion to prevent duplicate initialization of CodegenTestFiles
instance in CodegenTestCase, which was happening in ScriptGenTest with multiple
invocation of loadFile()
2016-10-02 21:03:28 +03:00
Vsevolod 1ac07340c9 KT-13931 generate IntRange#contains with respect to side-effects on argument loading, test added 2016-09-29 17:56:18 +03:00
Denis Zharkov bb1b8cca20 Fix AssertionError in CodegenUtil.getDelegates
Change getAllOverriddenDescriptors contracti, now it returns
original (not substituted) descriptors without any duplicates.

First of all it's necessary in CodegenUtil.getDelegates to avoid
duplicates (see assertion there), but also it's convenient for all
other usages of this method

 #KT-8154 Fixed
2016-09-28 11:40:35 +03:00