Commit Graph

53730 Commits

Author SHA1 Message Date
Ilya Matveev 1f2d31dffb Update Kotlin/Native: 1.3-dev-9301 2019-04-04 14:24:09 +07:00
Mark Punzalan a0940b1342 Use stricter assertions in for-loop bytecode text tests. 2019-04-04 09:07:19 +02:00
Mark Punzalan dd65e0876f Simplify loop building by encoding open/closed bound information in the
HeaderInfo object, and modifying the operator in the loop condition.

The "additional emptiness condition" is no longer necessary with this.
The open/closed property was removed from HeaderInfo in an earlier
commit, but bringing it back in to simplify the loop building makes
more sense.

Also expanded tests for evaluation order of range bounds.
2019-04-04 09:07:19 +02:00
Mark Punzalan 7680e7fd56 Use while loop for progressions that cannot overflow (instead of
do-while with enclosing "not empty" check).

Also do not add additional "not empty" condition for `until` loops when
the given bound is a constant != MIN_VALUE.
2019-04-04 09:07:19 +02:00
Mark Punzalan ba0e016c4e Add bytecode tests for array for-loop iteration. 2019-04-04 09:07:19 +02:00
Mark Punzalan 7afe121238 Eliminated the redundant ForLoopHeader.needsEmptinessCheck property, cast "bound" to progression type if necessary, fixed variable declaration order. 2019-04-04 09:07:19 +02:00
Mark Punzalan 6b83c04472 Cast step expression to the correct Number type, if necessary. 2019-04-04 09:07:19 +02:00
Mark Punzalan f6e74079bb Cleanup ForLoopsLowering: Add more comments, remove descriptor usages,
make code style consistent.
2019-04-04 09:07:19 +02:00
Mark Punzalan ea9572ad28 Add DefaultProgressionHandler that handles for-loops over
non-specialized progressions, including "step" progressions.

DefaultProgressionHandler uses the "first/last/step" properties of
the progression when building the loop header.
2019-04-04 09:07:19 +02:00
Mark Punzalan 301ac90770 Remove "bound" and "closed" properties from HeaderInfo and
ForLoopHeader, instead assuming that all ranges are closed and that the
"last" property is already property calculated.

This means the HeaderInfo.last for arrays, "indices" and "until"
progressions are decremented from the bound. This simplifies the loop
construction and moves the work to the handlers. This will also simplify
the handling of "reversed()" in the future since we don't need to
consider the case where the lower bound is open.
2019-04-04 09:07:19 +02:00
Mark Punzalan 93deff5e57 Rename "lowerBound/upperBound" to "first/last" and move loopVariable to
ForLoopHeader base class.

These terms are less loaded and less confusing, especially with "downTo"
progressions, and once we start handling "reversed()".
2019-04-04 09:07:19 +02:00
Mark Punzalan 8e1be5424f Handle for (i in a until Int.MIN_VALUE) corner case by adding
an additional "not empty" condition produced by the UntilHandler.
2019-04-04 09:07:19 +02:00
Mark Punzalan 7b153b2b68 Move building of "not empty" condition (used to check if loop is empty)
from ForLoopsLowering into ForLoopHeader, reducing the building logic in
ForLoopsLowering.
2019-04-04 09:07:19 +02:00
Mark Punzalan a2e3d3635e Replace HeaderInfo.increasing property with a "direction" enum property,
which is computed based on the value of "step" (if possible).
2019-04-04 09:07:19 +02:00
Mark Punzalan ed9ede8936 Make HeaderInfo.step not nullable and have handlers explicitly provide
the step expression.

The semantics of "step" are now clearer: It will no longer be negated
based on the "increasing" property; if the progression is decreasing
(i.e., for "downTo" progressions), then it must be negative. The
"increasing" property is still used when building the emptiness
condition.
2019-04-04 09:07:19 +02:00
Mark Punzalan 40dbf8a3fd Move elementType() and getProgressionType() extension methods into
ProgressionType.
2019-04-04 09:07:19 +02:00
Mark Punzalan 409d99a52a Add ForLoopsLowering to JVM phases.
Also deleted StepHandler. Since the HeaderInfo.needLastCalculation is
only set to true for handling step progressions, deleted that property
and all associated logic around it.
2019-04-04 09:07:19 +02:00
Mark Punzalan 7276b7e66a Fix compilation errors after rebasing. 2019-04-04 09:07:19 +02:00
Mark Punzalan 656f6855bb Minimal porting of ForLoopsLowering from kotlin-native.
Diffs resulting from the port:
https://github.com/punzki/kotlin-native/compare/master...punzki:for-loop-diff

When ForLoopsLowering is added to the JVM lowering phases, this causes some of the forLoop bytecode tests to pass, and many still fail due to differences in behavior compared to non-IR backend:
- Generated conditions for lowered loop
- Generated temporary variables
- Supported iterables (e.g., withIndex(), CharSequences)
- Means of incrementing induction variable

The phase will be added once more TODOs are resolved and it is more functionally complete, to prevent breaking for loops.
2019-04-04 09:07:19 +02:00
Toshiaki Kameyama f861b10798 Add "Add getter/setter" quick fix for uninitialized property
#KT-30078 Fixed
2019-04-04 11:10:39 +07:00
Austaon efcc6f0967 Add inspection for Integer.toString(i) to i.toString() (KT-12721) 2019-04-03 19:12:54 +03:00
Ilya Gorbunov dde2b30601 Clarify wording in Random.nextUInt docs: missed extra 'not' 2019-04-03 16:31:03 +03:00
Yan Zhulanow 69353ee9bf Async stack traces: fix compatibility with kotlin-stdlib 1.2.70 (KT-30611) 2019-04-03 15:46:33 +03:00
Yan Zhulanow ef06009669 191: Fix test running for common modules in MPP/Gradle (KT-29908) 2019-04-03 15:46:32 +03:00
Yan Zhulanow ee42c1211a 191: Update target IntelliJ SDK version to 191.6183 2019-04-03 15:46:32 +03:00
Ilya Kirillov b7e6dc4f8b Fix as32 test generation 2019-04-03 14:48:54 +03:00
Sergey Igushkin e23b74792d Fix Java sources inspected too early in Android variants (KT-30735)
The Android Gradle plugin can set Java sources after a variant is
created, similar to AP options. We need to inspect the Java sources
only from at `afterEvaluate` time.

Issue #KT-30735 Fixed
2019-04-03 14:45:52 +03:00
Ilya Matveev 5ab9723ee1 Configure CocoaPods plugin to be published at the plugin portal 2019-04-03 18:07:49 +07:00
Alexander Podkhalyuzin a7b43a6bb7 Import only classes when setting add unambiguous on the fly is enabled
#KT-30514 Fixed
2019-04-03 13:51:21 +03:00
Mikhael Bogdanov 4450641321 Merge inlineCodegenUtils2.kt into inlineCodegenUtils.kt 2019-04-03 11:43:46 +02:00
Mikhael Bogdanov be954c6e62 Rename LabelOwner into ReturnLabelOwner 2019-04-03 11:43:45 +02:00
Mikhael Bogdanov 20adce165f Convert CapturedParamDesc.java into Kotlin 2019-04-03 11:39:59 +02:00
Mikhael Bogdanov a19cc8efa6 Rename .java to .kt 2019-04-03 11:39:58 +02:00
Mikhael Bogdanov c6fb8ba08e Convert CapturedParamInfo.java into Kotlin 2019-04-03 11:39:58 +02:00
Mikhael Bogdanov 79c97ba21d Rename .java to .kt 2019-04-03 11:39:57 +02:00
Mikhael Bogdanov d8336bd0a1 Convert ParameterInfo.java into Kotlin 2019-04-03 11:39:56 +02:00
Mikhael Bogdanov 53dd1dd76d Rename .java to .kt 2019-04-03 11:39:55 +02:00
Ilya Kirillov 243fd2f4f1 New J2K: Move nullability analysis tests to nullabilityAnalysis dir 2019-04-03 11:24:30 +03:00
Ilya Kirillov 854fc6a7d7 New J2K: Handle correctly modifiers of class members when there is no parent class in the AST 2019-04-03 11:24:29 +03:00
Ilya Kirillov c05a01e12b New J2K: Fix NPE if no constructor was found in ImplicitInitializerConversion 2019-04-03 11:24:28 +03:00
Ilya Kirillov 6182edadfd New J2K: Move imports into JKImportList 2019-04-03 11:24:27 +03:00
Ilya Kirillov 86fa54fae9 New J2K: Convert Java method to Kotlin function independently of containing class 2019-04-03 11:24:26 +03:00
Ilya Kirillov f28f340840 New J2K: Wrap ast to a JKTreeRoot 2019-04-03 11:24:26 +03:00
Ilya Kirillov ddee0deeca New J2K: Move println conversion functionality to BuiltinMembersConversion 2019-04-03 11:24:25 +03:00
Ilya Kirillov ce666295f7 New J2K: Fix npe when converting java member without parent 2019-04-03 11:24:24 +03:00
Ilya Kirillov 088241313a New J2K: Remove unused JKJavaDefaultNewExpressionImpl 2019-04-03 11:24:23 +03:00
Ilya Kirillov 50a4b9b2b5 New J2K: Remove debug println 2019-04-03 11:24:22 +03:00
Ilya Kirillov 31aea1e5e9 New J2K: Fix converting on copy-past 2019-04-03 11:24:22 +03:00
Ilya Kirillov 5ab9d6bba8 New J2K: Fix collected import inserting in J2K 2019-04-03 11:24:21 +03:00
Ilya Kirillov 1dd0a42298 New J2K: Escape name of declaration in convert data class 2019-04-03 11:24:20 +03:00