Commit Graph

35 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 199ec60742 [JVM] Reduce number of param slots for string concatenation
With paramSlot = 200 those tests fails on JDKs which are newer than JDK 9
- testConcatDynamic200Long
- testConcatDynamicIndy200Long()
2021-08-01 22:23:48 +03:00
Mikhael Bogdanov 0fd1f549a9 Properly process special symbols during indy-with-constants concatenation
#KT-47320 Fixed
2021-06-26 06:10:16 +02:00
Mikhael Bogdanov dfc6d85aee Enable runtime string concatenation by default (for -Xjvm-target=9 or greater)
#KT-42522 Fixed
2021-04-27 09:08:28 +02:00
Mikhael Bogdanov 134fda8bad Support Unit/V types in string-concat indy calls
unitComponent.kt test fails with JVM target 9+
2021-02-17 18:43:24 +01:00
Dmitriy Novozhilov f61a318c9d [Test] Migrate AbstractBytecodeTextTest to new test infrastructure 2021-01-25 17:11:21 +03:00
Mikhail Glukhikh 1c71e64f58 [FIR] Create string interpolating call even for single argument
Before this commit, questionable optimization existed which
unwrapped string interpolating call with single argument to this argument.
However, this led to source element loss and the necessity of sub-hacks.
In this commit we dropped this optimization (anyway user can remove
this single-expression string template in code if needed) to keep
source elements intact.
2020-11-26 08:37:50 +03:00
Mikhael Bogdanov ed5c2b0565 Add tests for data class runtime string concatenation
#KT-35176
2020-10-06 13:20:41 +02:00
Mikhael Bogdanov eb32a6ddbd Add test for for kt42457 wrong behaviour. Align runtime concatenation with it
#KT-42457
2020-10-06 13:20:40 +02:00
Mikhael Bogdanov d2c4be18a0 Rename runtime-string-concat option into 'string-concat' 2020-10-06 07:14:39 +02:00
Mikhael Bogdanov cf5bd38bec JVM_IR. Support runtime string concatenation 2020-10-02 11:47:28 +02:00
Mikhael Bogdanov 1938f9459f Support indy concatenation 2020-10-02 11:47:28 +02:00
Mikhael Bogdanov 942e1962d9 Properly process constants 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov c329c22630 Add runtime string concat options. Some renaming 2020-10-02 11:47:27 +02:00
Mikhael Bogdanov 04012951c1 Basic invokedynamic string concatenation support 2020-10-02 11:47:27 +02:00
Mark Punzalan 238cc7c257 [FIR] Enable BytecodeText tests for FIR.
143 out of 767 tests (18.6%) are currently failing.
2020-09-29 10:21:21 +03:00
Steven Schäfer 58685be4e2 IR: Don't use IrStringConcatenation for ordinary toString calls
We can only use IrStrinConcatentation to represent calls to Any?.toString
and toString calls on primitive types. Otherwise, x.toString() and "$x"
are observably different when x is a non-null type with null value
(e.g., an @NotNull value coming from Java).
2020-03-27 17:31:48 +03:00
Mark Punzalan 4234fa79c0 [JVM IR] Use append(Char) for 1-length string literals in string
templates and plus concatenations.

This is slightly more efficient and mirrors the behavior of the non-IR
backend for templates (but not for plus concatenations).

#KT-36638 Fixed
2020-03-26 12:39:39 +03:00
Mark Punzalan ba606147c9 [JVM IR] Maintain KT-36625 bug compatibility between non-IR and IR
backends by removing IMPLICIT_NOTNULL casts from IrStringConcatenation
arguments.

Also fixed an issue where IrStringConcatenation can be lowered into
a null String instead of a literal "null" String if the lone argument
was a platform type String or String with enhanced nullability and the
value was null (e.g., "${FromJava.nullPlatformString()}").
2020-02-12 22:57:15 +03:00
pyos fc6b03b08f JVM_IR: move const initialization handling to lowering
Had to edit some bytecodeText tests to account for the fact that JVM_IR
no longer generates explicit initializations for ConstantValue fields,
but NoConstantValueAttributeForNonConstVals is not the default yet.
2019-11-29 16:49:52 +01:00
Steven Schäfer c2de89cb8c Minor: Make String.valueOf bytecode tests more precise 2019-10-18 17:24:12 +02:00
Steven Schäfer 3659b517bb Minor: Fix some test cases 2019-10-07 12:54:11 +02:00
Steven Schäfer f2392a6a28 Remove Concat and StringPlus intrinsics in favor of IrStringConcatenation. 2019-04-24 12:04:12 +02:00
pyos 5b595b58b2 JVM_IR: fold constant string concatenations 2019-04-23 16:20:43 +02:00
Ting-Yuan Huang 79fcaae991 Implement constant folding in the IR backend for JVM
The newly added pass folds the set of constant functions of the
current backend, plus IrBuiltIns.
2019-03-20 21:02:55 +01:00
Mark Punzalan fc5eac26cd Extracted complex string concatenation bytecode test case into separate test data file. 2019-02-27 08:36:35 +01:00
Mark Punzalan d4d5a6011c Flatten nested string concatenation expressions into a single IrStringConcatenation, in a separate lowering phase.
Consolidating these into IrStringConcatenations allows the backend to produce efficient code for string concatenations (e.g., using StringBuilder for JVM).
2019-02-27 08:36:35 +01:00
Mads Ager 3a11322506 Enable bytecode text tests for the JVM_IR backend. 2018-12-21 16:20:45 +01:00
Mikhail Zarechenskiy 9aa4247065 Do not box primitives in a single-entry string template expression 2018-07-20 13:46:11 +03:00
Dmitry Petrov 54cf11fd0a Skip empty string entries when generating string template expression
#KT-19738 Fixed Target versions 1.2.50
2018-04-20 14:52:14 +03:00
Dmitry Petrov 8c7352e668 Generate constant "" for effectively empty string 2017-07-17 09:18:41 +03:00
Dmitry Petrov a84c2a6f31 Improve string concatentation & string templates code generation
Reuse StringBuilder instances for nested subexpressions.
(NB StringBuilder instance for string template with a string
concatenation inside an expression entry, such as `"${"a" + "b"}"`,
will not be reused, although that doesn't seem to be a real-life issue).

 #KT-18558 Fixed Target versions 1.1.4
 #KT-13682 Fixed Target versions 1.1.4

Join adjacent strings literals, escaped strings, and constant values
(in a language version that supports const val inlining).
Use StringBuilder#append(char) for single-character constants
(e.g., " " in "$a $b").

 #KT-17280 Fixed Target versions 1.1.4
 #KT-15235 Fixed Target versions 1.1.4
2017-06-27 14:28:42 +03:00
Alexander Udalov bab127ad33 Remove some legacy codegen tests, move some to generated 2016-03-09 10:25:38 +03:00
Yan Zhulanow 9d1af5a17e Fix tests: "infix modifier required" and "operator modifier required" errors 2015-11-27 15:51:11 +03:00
Michael Bogdanov c63ac3e30a Test for KT-7222 Redundant boxing on toString call
#KT-7222 Fixed
2015-04-07 16:05:42 +03:00
Michael Bogdanov 0efe8890b8 Added new string tests 2015-04-07 16:05:42 +03:00