Commit Graph

9 Commits

Author SHA1 Message Date
Alexey Andreev
8fe96664b7 Fix initialization order of enum with companion object in JS BE
Make enum entries initialize before companion object. This helps
in situation when companion object initializer refers to enum fields.
JVM be generates <clinit> method which first initializes all enum fields
and then runs companion object initializer. This commit introduces the
similar behaviour in JS BE. The old behaviour was: initialize companion
object in constructor. In enum, constructor is called to initialize
enum fields, so previously companion object was initialized first,
which is incorrect.

See KT-16745
2017-03-28 11:32:46 +03:00
Yan Zhulanow
e25e19c4d6 Refactoring: Remove light analysis test data
The light analysis test data is not needed anymore cause the light analysis result is now automatically checked against the one from the full analysis.
2017-03-21 20:49:36 +03:00
Pavel V. Talanov
d34b73befb Light class codegen: all objects are considered static
Simplify code handling access flag computation
Fix a problem where kotlin nested object wasn't producing a nested light class
2017-03-15 20:55:01 +03:00
Denis Zharkov
ecec87cbc7 Refine signature calculation for methods with default parameters
The problem was that he number of mask parameters for defaults when
generating methods declaration was being calculated upon resulting signature
(with additional parameters: extension receivers, enum name/ordinal),
while on call-sites the masks number was calculated by the arguments number
in resolved call, i.e. by the number of real value parameters.

And because of the additional synthetic parameters (like enum.ordinal) these
two numbers could be different.

The solution is just to use value parameters number in both places.
Note, that we only count value parameters from the original sourse
declaration, ignoring synthetic ones generated by backend (e.g.
Continuation for suspend functions)

 #KT-14565 Fixed
2017-02-28 10:42:07 +03:00
Dmitry Petrov
ee9a174c1f KT-7897 Do not require to call enum constructor for each entry if all parameters have default values
Do not report an error on enum entry without initializer if all parameters have default values
(error is still reported if there is no such constructor, or if the constructor call is ambiguous).

Record resolved call on KtEnumEntry.

NB is the enum entry has a corresponding subclass, we still have to generate the "default" constructor call,
because FE doesn't know about the platform-specific representation of that class and its constructors.

See also KT-14097, KT-15900
2017-01-24 16:59:47 +03:00
Yan Zhulanow
5844f3cf1b Kapt3: Write stub class files with metadata (needed for incremental compilation) 2016-12-28 22:28:30 +03:00
Alexander Udalov
5402d50ea3 Light analysis tests: do not render empty lines between classes and in the beginning 2016-12-23 22:30:48 +03:00
Anton Bannykh
1957ac347a JS: make enum valueOf() throw if not found. 2016-12-15 17:58:40 +03:00
Yan Zhulanow
328286ab14 Use box tests to check if the light analysis mode (without analyzing bodies when possible) produces the same result as the complete analysis. See also the next commit in which light analysis mode is applied. Note that no tests were changed. 2016-12-05 19:57:47 +03:00