Commit Graph

384 Commits

Author SHA1 Message Date
Dmitry Petrov 4e42cc6b81 Save/restore stack in try-expressions (and statements).
Parse TryCatchBlockNode's in generated bytecode, infer stack save/restore points.
Save stack to local variables before 'try'.
Restore stack after the beginning of try-block, catch-block, and default handler.
Integrate before/after inline markers rewriting (otherwise it'll break our stacks).

 #KT-3309 Fixed
2015-07-07 12:16:29 +03:00
Ilya Gorbunov 456bab40d1 Ensure value of correct return type is on stack after intrinsic Char +/- Int and Char - Char binary operations. 2015-07-06 17:57:33 +03:00
Ilya Gorbunov 222d4002ac Add char binary operations to JVM codegen tests. 2015-07-06 17:57:25 +03:00
Alexander Udalov cb03f0df5a Fix casts of Unit value to other types 2015-07-06 16:14:06 +03:00
Ilya Gorbunov 39b27751df Drop deprecated char operations: correct test data. 2015-07-04 04:46:23 +03:00
Mikhail Glukhikh 6e2395471d Sealed code generation: sealed is considered abstract, correct serialization
A pair of tests provided.
2015-06-25 19:07:23 +03:00
dnpetrov f364d23ee9 KT-5347 VerifyError on local data class with closure
- generated copy() should push captured fields on stack
- refactor context lookup
- handle vars in local classes using instance fields

 #KT-5347 Fixed
2015-06-25 17:52:30 +03:00
dnpetrov c24e6b5698 Support 'break' and 'continue' in expressions
- generate fake jump instructions so that we can always analyze stack depths
- fix stack before break and continue by dropping excessive elements (e.g., *a*.foo(*b*, c?:continue))
- Analyzer rewritten in Kotlin, with more flexible control of CFG traversal

 #Fixed KT-3340
 #Fixed KT-4258
 #Fixed KT-7941
2015-06-25 17:40:55 +03:00
Mikhail Glukhikh 5fabb962ae Private constructors are now accessed via synthetic constructor with DEFAULT_CONSTRUCTOR_MARKER as an additional argument #KT-6299 Fixed
A set of tests provided. Some external tests fixed accordingly.
Companion object creation changed accordingly.
Derived classes now can use base class with the private constructor.
Refactoring of AccessorForFunctionDescriptor.
2015-06-24 12:30:11 +03:00
Michael Bogdanov 93c5a52d13 Updated exception table generation: try block return moved to uncatched interval
#KT-8148 Fixed
2015-06-24 09:48:55 +03:00
dnpetrov 36ae8790a1 KT-8011 Compiler crashes on attempt to create local class inside lambda
- use StackValue from upper-level context if local lookup fails

 #KT-8011 Fixed
2015-06-18 17:40:24 +03:00
dnpetrov 046189087a KT-5963 Call to super shouldn't require type specification if there is no conflict
Implemented unqualified 'super' type resolution (in BasicExpressionTypingVisitor).

No overload resolution of any kind is involved.
Corresponding supertype is determined by the expected member name only:
- 'super.foo(...)' - function or property (of possibly callable type) 'foo'
- 'super.x' - property 'x'
Supertype should provide a non-abstract implementation of such member.
As a fall-back solution for diagnostics purposes, consider supertypes with abstract implementation of such member.

Diagnostics:
- AMBIGUOUS_SUPER on 'super', if multiple possible supertypes are available;
- ABSTRACT_SUPER_CALL on selector expression, if the only available implementation is abstract.

#KT-5963 Fixed
2015-06-18 14:16:34 +03:00
Alexander Udalov 1a3209e1dc Drop traits with required classes
#KT-4771 Rejected
2015-06-17 16:23:58 +03:00
Alexander Udalov 98ce0d529c Fix incorrect 'original' in property accessors
#KT-3930 Fixed
2015-06-17 16:23:56 +03:00
Alexander Udalov 4dcc373a5a Fix concrete method inheritance in interfaces
For each non-abstract non-declared (i.e. inherited from supertypes) method in
an interface we generate its static form to the TImpl, which calls the TImpl
method from the corresponding supertype.

The accidental override tests changed because we're now trying to generate the
delegate for the super method, not knowing that it will clash with the declared
method

 #KT-2888 Fixed
 #KT-5393 Fixed
2015-06-17 16:23:56 +03:00
dnpetrov c369949d90 KT-6136 VerifyError on data class inheriting from trait
- coerce property values to proper data class component types
- add tests
 #KT-6136 Fixed
2015-06-16 09:58:03 +03:00
Denis Zharkov e3c3af6aab Change MISSING_CONSTRUCTOR_KEYWORD severity to error
And adjust testData
2015-06-12 11:23:13 +03:00
Denis Zharkov c9f79c2d05 Adjust testData: get rid of obsolete annotations 2015-06-12 09:23:31 +03:00
Michael Bogdanov dee26957d1 Tests for obsolete KT-4798, KT-7288, KT-7046
#KT-4798 Obsolete
 #KT-7288 Obsolete
 #KT-7046 Obsolete
2015-06-04 16:28:08 +03:00
Denis Zharkov 9802931a90 Remove variables with empty ranges from local vars table
As their ranges may intersect after dead code elimination that leads to VerifyError
2015-06-04 16:11:02 +03:00
Michael Bogdanov 83f04501be Remove error diagnostic from return in multideclaration
#KT-5100 Fixed
2015-06-04 12:01:59 +03:00
Pavel V. Talanov d2592e4a2c Companion objects have public visibility by default
#KT-7114 Fixed
2015-06-02 16:23:03 +03:00
Alexander Udalov df4d5a3ae2 Fix initialization order of enum entries and companion
#KT-5761 Fixed
2015-06-01 19:23:08 +03:00
Zalim Bashorov f3f799aab5 Fix secondary constructor tests for JS -- use non-zero fracitional part 2015-05-28 10:25:12 +03:00
Zalim Bashorov 3fe363e72b Minor: split test to access to companion and to nested object 2015-05-28 10:25:11 +03:00
Zalim Bashorov dc1b91eacd JS: prepare tests for secondary constructors 2015-05-28 10:24:48 +03:00
Alexander Udalov 6ae7ed1cc4 Add some new tests on functions and extension functions 2015-05-27 01:44:19 +03:00
Mikhail Glukhikh 4570872bfd Postfix expression code generation fixed as per KT-7561.
A set of tests for KT-7561 on codegen side, including exotic inc() functions().
 #KT-7561 Fixed.
2015-05-26 15:20:37 +03:00
Alexander Udalov 49004a8b8e Conform functions to extension functions and vice versa
#KT-5989 Fixed
2015-05-26 15:04:56 +03:00
Alexander Udalov 4141e0a8df Introduce fictitious numbered Function class descriptors 2015-05-26 15:04:54 +03:00
Michael Bogdanov 319c5aec60 Fix for KT-7557: NoSuchMethodError when capturing receiver in object expression
#KT-7557 Fixed
   #KT-7769 Fixed
2015-05-21 10:06:01 +03:00
Michael Bogdanov 226350b4ba Test data fixed: replace trait with interface 2015-05-18 11:57:39 +03:00
Michael Bogdanov 5daf79d2de Tests for obsolete KT-5232: vfy error with default parameter in method of trait
#KT-5232 Obsolete
2015-05-15 18:06:52 +03:00
Michael Bogdanov f1eb68c55a Test for obsolete KT-3579: UsupportedOperationException while trying to compile recursive trait
#KT-3579 Obsolete
2015-05-15 18:06:52 +03:00
Michael Bogdanov eb8d2d695c Test for non-general case of KT-4174 2015-05-15 18:06:51 +03:00
Mikhail Glukhikh 147bca3d22 Enum deprecated syntax detection implemented and integrated into DeclarationsChecker.
A lot of tests was changed to refactor deprecated syntax. Six new tests were added to check deprecated syntax detection.
Diagnostic for "enum entry uses deprecated super constructor": constructor is highlighted
Diagnostic for "enum entry uses deprecated or no delimiter".
One warning removed.
2015-05-15 16:13:34 +03:00
Mikhail Glukhikh 1a312140e9 New enum syntax: Short constructor syntax introduced for entries, optional commas between entries, semicolon after entries. #KT-7605 Fixed.
Grammar changed accordingly.
Semicolons prohibited after an entry except the last one.
Only one initializer is allowed per entry.
EnumReferenceExpression AST node introduced.
Some tests fixed, a pair of new tests written. Kotlin code inside project fixed.
Formatter and intendation tests fixed accordingly.
Stub version is incremented.
2015-05-15 16:13:32 +03:00
Mikhail Glukhikh cf741cb868 Enum parsing changed: first entries, then members. Grammar fixed accordingly.
A set of compiler tests and some plugin tests changed accordingly.
Compiler Kotlin code changed accordingly.
2015-05-15 16:13:27 +03:00
Dmitry Jemerov 4bdf598bfe compiler testdata: s/trait/interface 2015-05-12 19:43:17 +02:00
Dmitry Jemerov 9975bb8935 replace 'trait' keyword with 'interface' in user-visible messages and code generation tools 2015-05-12 11:49:37 +02:00
Denis Zharkov 849b8acbf8 Replace annotations with brackets in testData
Just in tests that changed after deprecation
2015-05-07 22:36:16 +03:00
Natalia Ukhorskaya 9108d87a57 Add warning for division by zero:
#KT-5529 fixed
2015-05-07 15:41:37 +03:00
Denis Zharkov 44a55e5bf6 Adjust testData to new labels syntax 2015-04-29 14:03:11 +03:00
Alexander Udalov 07c2442405 Make $default methods non-private, avoid generating accessors for them
#KT-5786 Fixed
2015-04-23 22:09:02 +03:00
Zalim Bashorov 1ef9b9db1f JS backend: add the support function expression
#KT-7242 Fixed
2015-04-22 12:48:22 +03:00
Zalim Bashorov 02071c5bdd Minor: move function expression tests to separate directory 2015-04-22 12:48:21 +03:00
Dmitry Jemerov 991db29731 drop covariant specialisation for supertypes 2015-04-13 15:28:50 +03:00
Michael Bogdanov de11ecb9b4 Fix for KT-7288: VerifyError on accessing array element in 'is' block
#KT-7288 Fixed
2015-04-07 16:05:42 +03:00
Michael Bogdanov 0efe8890b8 Added new string tests 2015-04-07 16:05:42 +03:00
Nikolay Krasko 2946c1d6a8 KT-7271 Accessing an extension property of Char.Companion leads to ClassNotFoundException in runtime
#KT-7271 Fixed
2015-04-07 15:59:05 +03:00