Commit Graph

5534 Commits

Author SHA1 Message Date
Denis Zharkov b6ccd03ef4 Make loops generation lazy
As well as all other kinds of expressions

While it's not necessary in a sense that 'for' loop can not be plain expression,
i.e. it can't be an argument for safe-call etc., but laziness is still very convenient property.

E.g. within attached test they were generated twice in case of last expression
of coroutine block, because coroutine related codegen part is built upon
assumption that all expressions should be generated lazy.
2016-06-21 15:52:44 +03:00
Denis Zharkov ad71934c55 Minor. Add 'operator' modifier in test for handleResult 2016-06-21 15:52:44 +03:00
Denis Zharkov fe5fe63f0a Fix visibility check for dynamic members within protected method
#KT-11857 Fixed
2016-06-21 11:07:36 +03:00
Alexander Udalov 311301f430 Check return type when locating method in reflection
#KT-11824 Fixed
2016-06-20 21:03:51 +03:00
Denis Zharkov 5ee33e6ad5 Generate last expression in coroutine block even for Unit expected type 2016-06-19 12:50:54 +03:00
Denis Zharkov 96eb3f411d Minor. Simplify 'async' tests 2016-06-19 12:50:54 +03:00
Denis Zharkov 72eb87f5d0 Support inline suspend functions
A lot of additional work was required to support them:
- Suspension points are being identified by two markers
  instead of one pointing to suspend function call
- Approach with replacing return type of suspend function does not work anymore.
  So we decode suspension return type as an argument for begin marker
- It became necessary to perform variables liveness analysis
  (see comment in org.jetbrains.kotlin.codegen.coroutines.CoroutineTransformerMethodVisitor.spillVariables)
2016-06-19 12:50:54 +03:00
Denis Zharkov e7b9564699 Support coroutine lambda parameters in JVM backend 2016-06-19 12:50:53 +03:00
Denis Zharkov 07dcc6c616 Support 'handleException' operator in JVM backend 2016-06-19 12:50:53 +03:00
Denis Zharkov 6795393989 Introduce 'handleException' operator and relevant checks 2016-06-19 12:50:52 +03:00
Alexander Udalov 0e881daba3 Update diagnostic tests ReadMe, explain tests with diagnostic arguments 2016-06-19 12:45:22 +03:00
Alexander Udalov 456ba79793 Consider callable reference's LHS when resolving RHS
Previous resolution sequence (static scope, nested classes scope, receiver) and
a check against type parameters only made sense when there's a type, not an
expression, on the LHS of a callable reference. Also TransientReceiver is
incorrect in such case because private-to-this visibility check only works for
ExpressionReceiver values
2016-06-19 12:45:22 +03:00
Alexander Udalov 6562a2db19 Type-check reference to property with invisible setter to KProperty
#KT-12337 Fixed
2016-06-19 12:45:22 +03:00
Mikhail Glukhikh 5ccbf47531 Elvis / if / when now infer error type in case of ErrorType + Nothing #KT-6665 Fixed
(cherry picked from commit 9a50a0b)
2016-06-17 16:43:24 +03:00
Mikhail Glukhikh 49fb9ff424 Sealed class hierarchies are now correctly processed in when (by checking possible smart casts to nested sealed classes) #KT-10648 Fixed
(cherry picked from commit 2eaaf9c)
2016-06-17 15:22:15 +03:00
Stanislav Erokhin 01430b4b99 Create hack for exception about "Empty intersection for types".
Hackaround for KT-11266, EA-79963, EA-72093,  EA-79976.
2016-06-17 01:39:44 +03:00
Alexander Udalov de986ed051 Do not skip synthesized members when generating bridges
The condition here is obsolete since SAM adapters can no longer be overridden:
they are now extensions in another scope

 #KT-12708 Fixed
2016-06-16 16:51:18 +03:00
Alexander Udalov af9883bccf Add test on accidental redeclaration of final members from java.lang.Enum
This is working because of the additional built-ins members added in 1.1
2016-06-16 16:51:18 +03:00
Alexander Udalov 79ecc9751b Report error on accidentally "overriding" wait/notify
Hard-code only Object members because diagnostics are reported for all other
classes out of the box in 1.1

 #KT-7174 Fixed
2016-06-16 16:51:18 +03:00
Alexander Udalov da332d1a27 Validate "-jvm-target" value in CLI, improve message 2016-06-16 16:51:18 +03:00
Alexander Udalov b4f81d4bb5 Use 'JVM_TARGET: 1.8' directive in codegen tests on 1.8 target 2016-06-16 16:51:18 +03:00
Dmitry Petrov 9240c82934 KT-12733 'rangeTo' as a non-qualified call is not optimized in 'for'
Use ResolvedCall corresponding to 'for' loop range expression
for optimized "for-in-range-literal".
Cleanup.
2016-06-16 11:30:05 +03:00
Dmitry Petrov a17b0dd1b5 KT-5075 Optimize array/collection indices usage in 'for' loop
Use specialized 'for' loop code generation strategy for loops over array indices and collection indices.
2016-06-15 14:01:18 +03:00
Mikhael Bogdanov 3a8591a729 Support 'jvm-target' in CLI 2016-06-15 13:43:29 +03:00
Mikhael Bogdanov 1c3ce93275 Generate same delagation structure as in jvm 6 target until new binary compatibility design
We need to make some decision about binary compatibility beetwen targets and semantics, so now old logic is used
2016-06-15 13:43:29 +03:00
Mikhael Bogdanov bb59638039 Support bridges in interfaces. Fix for KT-12416: Missed bridges in js backend
#KT-12416 Fixed
2016-06-15 13:43:28 +03:00
Mikhael Bogdanov 16159c483d Generate defaults methods on extending jvm6 interfaces 2016-06-15 13:43:27 +03:00
Mikhael Bogdanov 331341bd4d Don't generate delegates on overriding jvm8 interfaces 2016-06-15 13:43:27 +03:00
Michael Bogdanov 01aa89b1ea Generate delegation body for default interface methods, calculate proper abstractness for them 2016-06-15 13:43:26 +03:00
Mikhael Bogdanov 77a386a266 Move java8 'compileKotlinAgainstKotlin' test under 'codegen/java8/compileKotlinAgainstKotlin/jvm6' folder 2016-06-15 13:43:24 +03:00
Stanislav Erokhin 585dcbf1f3 KT-10717 Type inference for lambda with local return
#KT-10717 Fixed
2016-06-10 21:28:05 +03:00
Stanislav Erokhin 03241419bd Minor. removed several tests with error calls. 2016-06-10 21:28:04 +03:00
Dmitry Petrov c414f456a4 Like nested classes, it is not possible to reference inherited nested type alias by a child class. 2016-06-10 16:21:27 +03:00
Dmitry Petrov 7b6c1c092c Inherited type alias capturing type parameters of generic base class:
doesn't work partially due to KT-11123.
2016-06-10 16:21:27 +03:00
Dmitry Petrov bee1762b0e 'Nothing' as function return type and property type can't be abbreviated. 2016-06-10 16:21:27 +03:00
Dmitry Petrov 0ff677596f Modifiers checking for type aliases.
Exposed type checking for type aliases.
2016-06-10 16:21:26 +03:00
Dmitry Petrov 139e219ebd Star projections in type alias expansions are substituted to star projections
for corresponding type parameters in expanded type.
Test that type alias arguments are substituted literally,
and no type approximation is performed on substitution.
2016-06-10 16:21:26 +03:00
Dmitry Petrov 1efbd34529 Test: arguments of type aliases should be substituted literally,
without type approximation.
TYPE_MISMATCH is an expected error.
2016-06-10 16:21:26 +03:00
Dmitry Petrov 7da50069eb Additional tests for illegal type in type alias expansion:
'Array<Nothing>' passed as an unused parameter to type alias.
2016-06-10 16:21:26 +03:00
Dmitry Petrov 115f40d371 UNUSED_TYPEALIAS_PARAMETER: special diagnostic for typealias parameters
explicitly telling that such type parameters are not used in type checking.
Move typealias-related utility functions on types to TypeUtils.kt.
2016-06-10 16:21:25 +03:00
Dmitry Petrov 40dd36bcf6 Recursive type alias expansion:
when resolving abbreviated type, do not check bounds
if the resulting type contains type aliases.
2016-06-10 16:21:25 +03:00
Dmitry Petrov a4267f069d Codegen should just skip (local) type alias declarations. 2016-06-10 10:25:10 +03:00
Dmitry Petrov c04b16d6cc Type parameters for type alias constructor are declared type parameters for type alias
(no implicit type parameters from containing scopes).
2016-06-10 10:25:09 +03:00
Dmitry Petrov bcd1df4efe More tests for type alias constructor type parameters. 2016-06-10 10:25:09 +03:00
Dmitry Petrov 6924ed53ec Local type aliases: resolve 2016-06-10 10:25:09 +03:00
Dmitry Petrov 9a7bbc1516 Type alias shouldn't expand to a malformed type (e.g., 'Array<Nothing>'). 2016-06-10 10:25:09 +03:00
Dmitry Petrov d02785806d Type alias shouldn't capture type parameters of inaccessible outer classes. 2016-06-10 10:25:09 +03:00
Dmitry Petrov 12710bec2f Redeclaration errors for type aliases: type alias vs function. 2016-06-10 10:25:08 +03:00
Dmitry Petrov 5ad4c8b9c7 Redeclaration errors for type aliases: type alias vs property. 2016-06-10 10:25:08 +03:00
Denis Zharkov 92bd6880da Add AdditionalBuiltInsMembers language feature and relevant checks 2016-06-09 17:57:15 +03:00