Commit Graph

527 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy 3919dc94e1 Box values of inline class types when passing to function as varargs 2018-02-13 13:16:44 +03:00
Mikhail Zarechenskiy 80dd5c106e Propagate KotlinType through call generator, fix boxing on arguments 2018-02-13 13:16:42 +03:00
Dmitry Petrov 36128ba66f Don't generate primary constructor body for expect classes 2018-02-13 10:09:28 +03:00
Mikhail Zarechenskiy fefcddc803 Support boxing/unboxing for captured vars of inline class types 2018-02-09 05:06:29 +03:00
Mikhail Zarechenskiy c5c8d84719 Support boxing/unboxing for method return types 2018-02-09 04:56:36 +03:00
Dmitry Petrov 5678b3d52a Handle nullable case in '==' with smart cast using safe call 2018-02-07 14:30:59 +03:00
Dmitry Petrov 00325ae539 Handle equality checks for 'when' and data classes 2018-02-07 14:30:59 +03:00
Dmitry Petrov 299eb24ca9 Minor: simplify OperatorExpressionGenerator#invokeConversionFunction 2018-02-07 14:30:59 +03:00
Dmitry Petrov 22d59bb709 Minor: include descriptor itself in exception from DependenciesCollector 2018-02-07 14:30:59 +03:00
Dmitry Petrov 4776535205 Implement IR primitives for number comparisons in JVM BE 2018-02-07 14:30:59 +03:00
Dmitry Petrov bf18186045 More precise implicit cast generation
If an expression 'x' has a definitely non-null type 'T1',
and is used in position with an expected type 'T2',
cast 'x' to 'T2!!' (most common non-null type T*: T* <: T2).
2018-02-07 14:30:59 +03:00
Dmitry Petrov 9137e68d4e Implement special desugaring for numeric comparisons in PSI2IR
This introduces the following IR built-in functions required for proper
implementation of the number comparisons:

- ieee754Equals(T, T): Boolean,
    for each T in {Float?, Double?}

- less(T, T): Boolean
  lessOrEqual(T, T): Boolean
  greater(T, T): Boolean
  greaterOrEqual(T, T): Boolean
    for each T in {Int, Long, Float, Double}
2018-02-07 14:30:59 +03:00
Alexander Udalov ac5444ef7c Add declaresOrInheritsDefaultValue, move hasDefaultValue to 'resolution'
'hasDefaultValue' needs to be adapted to support locating default values
in 'expect' functions, and this is not possible in module 'descriptors',
where it was originally declared. Therefore, move it to module
'resolution' and copy its current logic to a separate function
'declaresOrInheritsDefaultValue' which is used in 5 places.
'hasDefaultValue' itself is updated in subsequent commits.

Besides changing imports, also use a simpler declaresDefaultValue in
some places, which does not include default values inherited from
supertypes: this is OK for constructors, and in LazyJavaClassMemberScope
for functions from built-ins which do not have default argument values
at all
2018-02-05 13:38:04 +01:00
Mikhail Zarechenskiy 915455ebe9 Introduce InlineClasses language feature
Allow to write `inline` modifier in front of class declaration
2018-02-05 12:07:38 +03:00
Ilya Chernikov 4eb557724c Convert compiler projects to the new intellij deps 2018-01-30 17:06:13 +03:00
Ilya Chernikov a4f28cd94f Make all dependencies to idea sdk intransitive 2018-01-30 17:06:11 +03:00
Alexander Udalov 543db380d2 Use isJvmInterface in JVM back-end instead of isInterface
To support const vals and proper initialization order for companions of
annotations (since 1.3+) as well as interfaces

 #KT-16962 Fixed
2018-01-24 15:54:35 +01:00
Alexander Udalov 907f53e539 Refactor ConstantValue implementations
Remove KotlinBuiltIns and take a ModuleDescriptor instance in getType
instead. This will allow to create constant values in contexts where
there's no module or built-ins accessible (such as, deserialization of
module annotations during indexing of .kotlin_module files in IDE).

Note that some values (KClassValue, EnumValue, AnnotationValue) still
take module-dependent objects (KotlinType, ClassDescriptor and
AnnotationDescriptor respectively). This is to be refactored later
2018-01-18 12:49:38 +01:00
Dmitry Petrov 6cb68531ae Minor: add missing "'" 2018-01-17 12:31:07 +03:00
Dmitry Petrov 1f841e35bc Formatting: psi2ir 2018-01-17 12:31:07 +03:00
Dmitry Petrov 432c743771 Formatting: ir.tree and some common code 2018-01-17 12:31:07 +03:00
Dmitry Petrov 4d54036d21 Use declaration properties in RenderIrElementVisitor 2018-01-17 12:31:07 +03:00
Dmitry Petrov 7dc15b15bb Add basic properties to IR declarations 2018-01-17 12:31:07 +03:00
Mikhael Bogdanov b539adf105 Support simple capturing in IR inliner 2018-01-16 11:53:25 +01:00
Mikhael Bogdanov ca22bc57fd Don't capture primary constructor variables 2018-01-16 11:53:25 +01:00
Mikhael Bogdanov 28f4cc5b18 Generate parameter name in assertion for lateinit properties 2018-01-16 11:53:24 +01:00
Mikhael Bogdanov e58558dffd Support mapped companions 2018-01-16 11:53:24 +01:00
Mikhael Bogdanov e57efc7233 Support external functions 2018-01-16 11:53:23 +01:00
Mikhael Bogdanov c1a1a7f9fb Code clean 2018-01-16 11:53:22 +01:00
Mikhael Bogdanov 9d7eca1376 Support throwNpe intrinsic 2018-01-16 11:53:22 +01:00
Mikhael Bogdanov d62a7cc9d1 Unwrap fake override on field access 2018-01-16 11:53:21 +01:00
Mikhael Bogdanov dfbe92344f Skip setter accessors for val 2018-01-16 11:53:21 +01:00
Mikhael Bogdanov 2b95e6bc0d Generate proper vararg array 2018-01-16 11:53:20 +01:00
Mikhael Bogdanov 724f3bf714 Return proper type after coercion 2018-01-16 11:53:20 +01:00
Mikhael Bogdanov 77b93ab7ad Add classType property in IrClassReference, support class references in codegen 2018-01-16 11:53:19 +01:00
Mikhael Bogdanov b2970ef771 Skip noinline lambdas during inline 2018-01-16 11:53:19 +01:00
Mikhael Bogdanov ab96e0102a Support IrGetClass 2018-01-16 11:53:18 +01:00
Mikhael Bogdanov 9a1f484771 Fix equals 2018-01-16 11:53:18 +01:00
Mikhael Bogdanov 3e1f471121 Rollback change in 'usesDefaultArguments' 2017-12-20 10:58:35 +01:00
Mikhael Bogdanov 32b90a1cae Generate type checker barriers in bridges 2017-12-20 10:48:52 +01:00
Mikhael Bogdanov be18cb9b16 Fix default methods visibility 2017-12-20 10:48:51 +01:00
Mikhael Bogdanov 9365d1d859 Remove redundant extra default mask for function with N*32 parameters 2017-12-20 10:48:51 +01:00
Mikhael Bogdanov ef5c3512cd Skip FAKE_OVERRIDE fields 2017-12-20 10:48:50 +01:00
Mikhael Bogdanov aeb74f7e70 Skip bridge generation for non real declaration on first step they would be processed later
~

~
2017-12-20 10:48:50 +01:00
Mikhael Bogdanov 4657ae06f4 Don't cast receiver to super type on super calls 2017-12-20 10:48:49 +01:00
Mikhael Bogdanov a936f75423 Fix empty vararg processing in intrinsics 2017-12-20 10:48:49 +01:00
Mikhael Bogdanov 420b9fdaa9 Support interface companion object lowering 2017-12-20 10:48:48 +01:00
Mikhael Bogdanov 24336113a2 Support class companion object lowering 2017-12-20 10:48:48 +01:00
Mikhael Bogdanov 224adfabc5 Support synthetic accessors for constructors 2017-12-20 10:48:47 +01:00
Mikhael Bogdanov 5cbfdf6024 SyntheticAccessorLowering refactoring 2017-12-20 10:48:47 +01:00