Commit Graph

56861 Commits

Author SHA1 Message Date
Alexander Udalov dfea94aef5 Minor, use INTRINSICS_CLASS_NAME constant instead of hardcoded string 2019-08-12 16:09:24 +02: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
Alexander Udalov e207c96336 Throw NPE instead of TypeCastException since 1.4
#KT-22275 In Progress
2019-08-12 16:09:23 +02:00
Alexander Udalov 2baddb029c Use Intrinsics.checkNotNullParameter to throw NPE in parameter null checks
Similarly to previous commits, this method was unused, so we're changing
its semantics in API version >= 1.4.

 #KT-22275 In Progress
2019-08-12 16:09:23 +02:00
Alexander Udalov 480313210a Use Intrinsics.checkNotNullExpressionValue to throw NPE in Java null checks
Similarly to previous commit, this method was unused since its
introduction before 1.0, so we're changing its semantics to throw NPE
and starting to use it with API version >= 1.4.

 #KT-22275 In Progress
2019-08-12 16:09:23 +02:00
Alexander Udalov a7c8fdcbe2 Use Intrinsics.checkNotNull and throw NPE in !! operator generation
This method was introduced in c204e8fc67 "just in case" and was never
used. Therefore we're free to change its semantics and use it in all new
generated code (with API version >= 1.4), without even worrying that the
newly used API will leak from inline functions in stdlib when used with
an older API version. Since we agreed to change the type of thrown
exceptions to java.lang.NPE in KT-22275, invoke a new method
throwJavaNpe now which throws that exception instead of KNPE.

Note that the additional method that takes an exception message is still
unused and exists just in case we need to use it in the future. The new
method throwJavaNpe is public also "just in case" we need to invoke it
in the future; currently it's not invoked from the bytecode.

 #KT-22275 In Progress
2019-08-12 16:09:23 +02:00
Igor Chevdar 6106b72283 [IR] Fixed bug with fake override building 2019-08-12 17:07:44 +03:00
Igor Chevdar ffdf3c361e [K/N libraries] Used fictitious functional interfaces factory 2019-08-12 17:07:44 +03:00
Igor Chevdar 226013353d [IrSerializer] Removed hacks with functional interfaces 2019-08-12 17:07:43 +03:00
Igor Chevdar 00dc335559 [IrSerializer] Preparations for functional interfaces handling 2019-08-12 17:07:43 +03:00
Alexander Udalov c007f3efb3 Minor, move lazyClosure out of TypeUtils.kt 2019-08-12 14:57:21 +02:00
Alexander Udalov cb8f70189d Minor, add debug info to assertion in AddContinuationLowering 2019-08-12 14:57:21 +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
Sergey Rostov 555e1a35e9 .idea: remove maven project from default config
Currently maven was not support in our JPS build.
You can still import them manually.
2019-08-12 10:58:15 +03:00
Sergey Rostov ba9c632f15 Gradle, npm: use state file as fake output for :kotlinNpmInstall task
This is required in case when NpmSimpleLinker works (instead of yarn).
NpmSimpleLinker will not produce yarn.lock file, so :kotlinNpmInstall
was always up-to-date. Adding fake state file fixes the problem.

#KT-32874 Fixed
2019-08-12 10:41:16 +03:00
Sergey Rostov 6b5739bd6a Gradle, ProcessedFilesCache: don't report on clashes with for targets with removed source 2019-08-12 10:41:15 +03:00
Abduqodiri Qurbonzoda 84971d2003 Mention union in intersect documentation and vice versa (KT-26212) 2019-08-12 01:15:20 +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
Alexander Udalov 570d66be46 Support "// !API_VERSION: LATEST" directive in tests
Useful for tests that check behavior which depends on having a recent
API version enabled, and that don't want to depend on a specific fixed
API version (to prevent eventual obsoletion)
2019-08-09 15:47:58 +02:00
Alexander Udalov 13b07e71e8 Set AnalysisFlags.explicitApiVersion in tests with API_VERSION directive
To mimic the case of user passing an explicit "-api-version" flag to
avoid API version being inferred to the version of stdlib in
dependencies by JvmRuntimeVersionsConsistencyChecker
2019-08-09 15:47:09 +02:00
Alexander Udalov 9456763576 Minor, fix debug info when inferring API version 2019-08-09 15:47:09 +02:00
Alexander Udalov d0385e4e7c Recognize Intrinsics.checkNotNullParameter call on lambdas in inline functions
We're going to start using this method since 1.4 for parameter null
checks, and without this change the compiler would fail if it
encountered a call to such method on a lambda parameter inside an inline
function, since that call is not inlinable.

 #KT-22275 In Progress
2019-08-09 15:47:09 +02:00
Ilya Kirillov 09ab98a4f8 New J2K: Don't fail on captured types & don't use functional interface with captured types
Note: we have to print captured types for lambda parameters.
It is needed for nullability inference as it requires explicit types specification to work.
Later in post-processing we remove explicit type specifications for lambda parameters which have captured types

#KT-33186 fixed
2019-08-09 16:31:58 +03:00
Steven Schäfer 0c3c0989b4 JVM IR: Don't move inaccessible const fields out of interface companions 2019-08-09 15:22:30 +02:00
Yan Zhulanow 3742425547 Move out compiler plugins from the main IDE plugin JAR (KT-31279) 2019-08-09 20:07:28 +09:00
Georgy Bronnikov 310237a8b1 Correct expected test output 2019-08-09 13:09:49 +03:00
Steven Schäfer 73d2ae961c JVM IR: BridgeLowering boxing fixes 2019-08-09 12:14:44 +03:00
Steven Schäfer 6aa8ecd745 JVM IR: Remove bridge construction from CallableReferenceLowering 2019-08-09 12:14:44 +03:00
Ilya Gorbunov ebb59d51d2 Fix incorrect Double.toLong conversion for infinite values in JS
#KT-33225 Fixed
2019-08-09 11:49:28 +03:00
Dmitriy Novozhilov 8bf61a12df Minor. Remove UNREACHABLE_CODE slice from BindingContext
There was no reading from that slice, so it is redundant
2019-08-09 09:56:37 +03:00
Toshiaki Kameyama 154cf46f7c New J2K: add ReplaceGuardClause inspection to post-processing
#KT-22412 Fixed
2019-08-09 00:43:28 +03:00
Nicolay Mitropolsky 51e007116f KotlinLineMarkerProvider: ignore non-leaf elements when putting gutters (KT-28075, KT-30052, KT-33182)
previously for instance `KtClassBody` could get here as `leaf` and `leaf.parent` will return `KtClass` for it, making gutter for `KtClass` appear twice if origingal identifier and `KtClassBody` got here in different passes (one in "inner" other in "outer")
2019-08-08 16:38:47 +03:00
Dmitriy Novozhilov c3ea0a1e5b [FIR] Add forgotten visit of annotation for FirAbstractLoop 2019-08-08 15:47:24 +03:00
Mikhael Bogdanov 1eda42cb88 JVM_IR. Generate SMAP information for anonymous classes
#KT-28092 Fixed
2019-08-08 12:02:50 +02:00
Mikhael Bogdanov a444a40849 JVM_IR. Basic support of 'inlineCallSiteInfo' 2019-08-08 12:02:49 +02:00
Steven Schäfer f34a08cbbf JVM IR: Convert interface companion fields to static fields. 2019-08-08 12:01:52 +02:00
Yan Zhulanow e6211c4995 Debugger: Fix the compilation error in as33 bunch 2019-08-08 04:26:10 +09:00
Toshiaki Kameyama f5c0a30c51 Add intention to replace "Map.getOrDefault"
#KT-21503 Fixed
2019-08-07 17:38:15 +03:00
Mikhail Zarechenskiy e09ae645b3 Advance bootstrap version to 1.3.60-dev-770
Follow-up of KT-33157.
 This is needed to have proper signatures in stdlib afte the fix (80acc56c10)
2019-08-07 17:29:44 +03:00
Mikhail Zarechenskiy 9f0991f0aa Minor, clean up type approximator a bit 2019-08-07 16:06:45 +03:00
Mikhail Zarechenskiy 04e57f712e [NI] Introduce feature for passing function references with defaults
Relates to KT-8834, we continue reducing differences between old and new
 inference. Note that as for `SamConversionPerArgument`, this feature
 is enabled in the compiler and not in the IDE to avoid breaking code
 for those users that already enabled new inference in the compiler
2019-08-07 15:58:36 +03:00
Mikhail Zarechenskiy 0219b86d06 [NI] Fix poor performance of recursive types approximation
#KT-32407 Fixed
2019-08-07 15:21:16 +03:00
Mikhail Zarechenskiy 5f76918c90 [NI] Use approximator as a component, don't recreate it during resolve 2019-08-07 15:21:15 +03:00
Ilya Chernikov cddabf140b Implement proper expression generation for the last script line
fixes problem with result fields
#KT-33127 fixed
2019-08-07 11:26:37 +02:00
Sergey Igushkin ec54246b3a Fix TCServiceMessagesClient not removing an empty line prefix on Windows 2019-08-07 12:20:13 +03:00
Steven Schäfer 471b515adb Avoid getTopLevelClass in firMode 2019-08-07 10:34:43 +02:00
Steven Schäfer 43a27ab58c (Un)mute tests 2019-08-07 10:34:43 +02:00
Steven Schäfer 70aee4f9e2 JVM IR: Handle -Xassertion modes 2019-08-07 10:34:43 +02:00
Steven Schäfer 7b2edc6de8 Extract simple inlining utility from ArrayConstructorLowering 2019-08-07 10:34:43 +02:00
Steven Schäfer d11344ce2e Add more tests for -Xassertions=jvm corner cases 2019-08-07 10:34:43 +02:00