Commit Graph

65666 Commits

Author SHA1 Message Date
Anton Bannykh b5f31a3d76 JS IR: make CodeCleaner more conservative
The CodeCleaner treated all expressions with type `Nothing` as
non-terminating. This is not true for cases when return type is generic,
e.g:

```
fun <T> foo(): T = Any() as T

foo<Nothing>() // type: Nothing
```

This change makes the CodeCleaner more conservative, so that it doesn't
treat to such functions as non-terminating. This eliminates the need
to change call types from Nothing to Unit in
KotlinNothingValueExceptionLowering.
2020-05-13 16:30:47 +03:00
pyos 8809abdbac JVM_IR: do not handle Nothing in suspend tail call bridges
Else they wouldn't be tail call, would they?
2020-05-13 05:54:37 -07:00
Ilmir Usmanov 0acaedef92 Fix attribute clash between STATIC_INLINE_CLASS_REPLACEMENT and original
Attributes are used to name continuation classes and are generated
before inline classes processing. During the processing, for override
functions in inlined classes, the compiler generates
STATIC_INLINE_CLASS_REPLACEMENT function with body of the override.
The override's body is replaced with delegating call to
STATIC_INLINE_CLASS_REPLACEMENT. However, since we need to keep the name
of the continuation class, we copy attributes from the override to
STATIC_INLINE_CLASS_REPLACEMENT. This leads to attribute clash during
AddContinuationLowering.
So, to fix the issue, do not use the attribute of
STATIC_INLINE_CLASS_REPLACEMENT in original->suspend map.
As an optimization, do not generate continuation for the override
function.
2020-05-13 14:53:37 +02:00
Alexander Udalov d2a691d157 Minor, ignore failing box tests for light analysis 2020-05-13 13:54:51 +02:00
Mark Punzalan 99856afc31 ForLoopsLowering: Use @file:OptIn(ExperimentalUnsignedTypes::class)
instead of annotating declarations.
2020-05-13 13:54:35 +02:00
Mark Punzalan b5b361bb09 Add tests for nullable loop variable in for-loop over unsigned progression. 2020-05-13 13:54:35 +02:00
Mark Punzalan b85da8411d ForLoopsLowering: Convert ProgressionType from enum to sealed class and
move more logic into the class.

This refactoring simplifies their usage with fewer `when` switches and
passing around of Symbols.
2020-05-13 13:54:35 +02:00
Mark Punzalan 177967258b ForLoopsLowering: Eliminate construction/boxing/unboxing of UInt/ULong.
This needs further cleanup to encapsulate more logic into ProgressionType.
2020-05-13 13:54:35 +02:00
Mark Punzalan e1120f49d8 ForLoopsLowering: Reduce unnecessary temporary variables. 2020-05-13 13:54:35 +02:00
Mark Punzalan eaddd02e9b Mute/unmute failing/passing unsigned progression tests for FIR. 2020-05-13 13:54:35 +02:00
Mark Punzalan f249e7f5e9 ForLoopsLowering: Add additional bytecode text tests for optimization of
unsigned progressions.
2020-05-13 13:54:35 +02:00
Mark Punzalan 0e6af517d7 Generate tests for unsigned progressions using
GenerateSteppedRangesCodegenTestData.
2020-05-13 13:54:35 +02:00
Mark Punzalan 03ef3724f4 ForLoopsLowering: Add support for unsigned progressions. 2020-05-13 13:54:35 +02:00
Mikhael Bogdanov 9fdb1ff4f8 Call visit method on ClassWriter in IC caching in proper order 2020-05-13 13:45:10 +02:00
Igor Yakovlev df8031945b Allow UL class for KtEnumEntry declaration 2020-05-13 12:14:12 +03:00
Roman Golyshev 762f38a394 KT-38832 Add additional check to RemoveCurlyBracesFromTemplateInspection
- Expression in curly braces can change between the report of inspection
and quickfix application
- ^KT-38832 Fixed
2020-05-13 09:05:10 +00:00
Roman Golyshev 150708069c KT-38831 Use safe casts in ReplaceWithOperatorAssignmentInspection
- Assigned expression can change between reporting of inspection and
applying it
- ^KT-38831 Fixed
2020-05-13 09:05:10 +00:00
Roman Golyshev 225d354604 KT-38829 Add additional check to RemoveRedundantBackticksQuickFix
- Identifier's name can change between reporting of inspection and
applying a quickfix
- ^KT-38829 Fixed
2020-05-13 09:05:09 +00:00
Jinseong Jeon 6034fcdc46 FIR2IR: apply SAM conversion to arguments if needed 2020-05-13 11:28:48 +03:00
Alexander Udalov 0ce16b9d8c Support non-reified type parameters in typeOf in JVM and JVM_IR
#KT-30279 Fixed
2020-05-13 10:04:28 +02:00
Alexander Udalov 6fb40878c4 Minor, do not report "no reflection" error on KTypeParameter
Since an implementation of KTypeParameter for stdlib is coming, an
instance of which can be obtained through `typeOf`.
2020-05-13 10:04:27 +02:00
Alexander Udalov 37cf7316bc Do not calculate maxStack size manually when generating typeOf 2020-05-13 10:04:27 +02:00
Alexander Udalov 82603f3853 Move some codegen utilities to callableReferenceUtil.kt
Some of them were declared in ClosureCodegen near generation of function
references, and some in PropertyReferenceCodegen, which was confusing.
2020-05-13 10:04:27 +02:00
Alexander Udalov 4fe8754ba1 Minor, extract generation of typeOf out of inlineIntrinsics.kt 2020-05-13 10:04:27 +02:00
Alexander Udalov ea413cefb4 Remove TypeOfChecker for JVM frontend
This is needed to support typeOf with non-reified type parameters.

 #KT-30279
2020-05-13 10:04:26 +02:00
Mikhail Glukhikh 0c0f4ef3db FIR CFG: handle 'Dead' properly in edge kind merging 2020-05-13 10:37:08 +03:00
Mikhail Glukhikh 41f241f608 FIR CFG: merge DFA + CFA edge in Simple edge 2020-05-13 10:37:08 +03:00
Mikhail Glukhikh 32cfee50e0 FIR CFG: remove duplicating lambda enter -> exit connection 2020-05-13 10:37:08 +03:00
Mikhael Bogdanov 5ef37148ea Add flag for proper array convention with default args calls 2020-05-13 08:51:57 +02:00
Mikhail Bogdanov adc770b604 Process default arguments in array convention calls
#KT-16520 Fixed
2020-05-13 08:51:57 +02:00
Mikhail Bogdanov 3134832396 Call missed visit method on ClassWriter in IC caching
Otherwise ASM fails with error on invalid frames because bytecode version is 0
2020-05-13 06:29:23 +02:00
Sergey Rostov 4daac14008 Revert due to massive flaky tests 2020-05-12 23:01:01 +03:00
Vladimir Ilmov 5228da2ebc (CoroutineDebugger) 192/as36 compilation fix 2020-05-12 19:50:27 +02:00
Alexander Udalov 4597fff18a Prohibit OptionalExpectation on nested annotation classes
Because the new generation scheme based on module metadata does not
support them, and we don't plan to have them in the standard library
yet.
2020-05-12 19:28:58 +02:00
Alexander Udalov 012ffa2993 Support new scheme of compilation of OptionalExpectation annotations
Instead of generating these annotation classes as package-private on
JVM, serialize their metadata to the .kotlin_module file, and load it
when compiling dependent multiplatform modules.

The problem with generating them as package-private was that
kotlin-stdlib for JVM would end up declaring symbols from other
platforms, which would include some annotations from package
kotlin.native. But using that package is discouraged by some tools
because it has a Java keyword in its name. In particular, jlink refused
to work with such artifact altogether (KT-21266).

 #KT-38652 Fixed
2020-05-12 19:28:57 +02:00
Sergey Rostov 63e355d979 Scripting IDE cache: unblocking concurrent update
#KT-38875 Fixed
2020-05-12 19:49:43 +03:00
Jinseong Jeon 30e5748fec FIR: set proper visibility of property accessors. 2020-05-12 19:47:37 +03:00
Ilya Gorbunov 5d724a8cbc Fix samples package import
Dokka can only clean samples.* import when converting samples to
runnable.
2020-05-12 17:35:33 +03:00
Kirill Shmakov 84c6c365db Wizard: Reorder build phases in iOS template (fix KT-38810) 2020-05-12 17:32:37 +03:00
Kirill Shmakov cc7b8cc558 Wizard: Add KMM-related property in iOS template gradle.properties 2020-05-12 17:32:37 +03:00
Igor Yakovlev 84a582c618 Fix escaping const string literals in UL
Fixed #KT-38247
2020-05-12 17:04:16 +03:00
Igor Yakovlev 9f8044ff1b Fix ultraKtLightClassForFacade compiler backend call
+minor fixes
2020-05-12 17:04:16 +03:00
Igor Yakovlev 62c24c95b5 Add support for UltraLightScripts 2020-05-12 17:04:15 +03:00
Mikhail Glukhikh 6a2461f2c6 [FIR] Refactor boolean flags related to constructors: !no -> include 2020-05-12 16:57:08 +03:00
Mikhail Glukhikh db694dd7ab [FIR] Extract ConstructorScopeTowerLevel 2020-05-12 16:57:08 +03:00
Mikhail Glukhikh 22e7264460 [FIR] Use all implicit receivers for del. constructors, not just one 2020-05-12 16:57:08 +03:00
Mikhail Glukhikh 535b4434a8 [FIR TEST] Add extra test for inner classes inside hierarchy 2020-05-12 16:57:08 +03:00
Mikhail Glukhikh f48ff2679e [FIR] Branch delegating constructor call resolve by isInner from start 2020-05-12 16:57:07 +03:00
Mikhail Glukhikh 28c0dac36f [FIR] Set FirJavaClass.isInner properly 2020-05-12 16:57:07 +03:00
Mikhail Glukhikh 3aca40538b [FIR TEST] Fix error in exposedSupertype test 2020-05-12 16:57:07 +03:00