Commit Graph

33 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy
935f7b1cc1 Add warning if constant conforms to infinity or zero
#KT-3805 Fixed
2017-02-08 15:42:33 +03:00
Mikhail Zarechenskiy
b0c3c7463b Fix internal compiler error about arithmetic exception
#KT-8264 Fixed
2017-01-26 03:39:50 +03:00
Mikhail Zarechenskiy
25c3b43858 Support Infinity and NaN in constant evaluator
This allows to store infinities and NaNs inside const vals
2016-12-01 16:08:53 +03:00
Mikhail Glukhikh
ac3dfd93bd More correct handling of compile time constant types #KT-13421 Fixed 2016-08-18 14:42:16 +03:00
Ilya Gorbunov
25c4453dc5 Cleanup deprecated symbol usages in testData 2016-01-22 05:54:38 +03:00
Alexey Tsvetkov
294559a94f Overridable val should not be treated as constant
#KT-9443 fixed
2015-10-26 19:23:09 +03:00
Denis Zharkov
0b9c9a6047 Support builtin properties in ConstantExpressionEvaluator 2015-10-14 20:39:53 +03:00
Denis Zharkov
eebe66e041 Minor. Fix test with obsolete enum syntax 2015-09-18 10:14:31 +03:00
Pavel V. Talanov
c313887641 Split CompileTimeConstant into two entities
1. ConstantValue
	* just holds some value and its type
	* implementations for concrete constants
2. CompileTimeConstant
	* is only produced by ConstantExpressionEvaluator
	* has additional flags (canBeUsedInAnnotation etc)
	* has two implementations TypedCompileTimeConstant containing a constant value
		and IntegerValueConstant which does not have exact type
	* can be converted to ConstantValue

Adjustt usages to use ConstantValue if flags are not needed
Add tests for some uncovered cases
2015-07-16 02:28:05 +03:00
Dmitry Jemerov
4bdf598bfe compiler testdata: s/trait/interface 2015-05-12 19:43:17 +02:00
Pavel V. Talanov
06916d98c6 default -> companion: replace all mentions of default and default object 2015-03-17 15:47:39 +03:00
Pavel V. Talanov
59f192ef90 Replace 'class object' with 'default object' in renderers and test data
Includes changes to decompiled text
Old syntax is used in builtins and project code for now
2015-03-06 19:36:54 +03:00
Alexander Udalov
a7b88e9485 Make CharSequence.length a function instead of property
And String.length as well.

This is done for JVM interoperability: java.lang.CharSequence is an open class
and has a function 'length()' which should be implemented in subclasses
somehow.

A minor unexpected effect of this is that String.length() is now a compile-time
constant (it wasn't such as a property because properties are not supported in
compile-time constant evaluation)

 #KT-3571 Fixed
2014-11-27 20:38:17 +03:00
Michael Bogdanov
5412a67d29 Generate static backing fields for properties in object
#KT-4973 Fixed
2014-11-20 10:20:31 +03:00
Tal Man
aeb5bae556 Refactoring of CompileTimeConstant, introduce flag to represent a constant being referenced by a variable 2014-04-09 14:47:05 -04:00
Natalia Ukhorskaya
4a8bcc614a Resolve compileTimeInitializer for variable in lazy resolve 2014-03-13 10:07:18 +04:00
Natalia Ukhorskaya
89d99d2848 Remove toInt() from rendering IntValue 2014-03-13 10:07:17 +04:00
Natalia Ukhorskaya
df3ed5059c StorageManager for compile-time initializer 2014-03-13 10:07:12 +04:00
Natalia Ukhorskaya
9672026a53 Add a superclass for byte, short, int, long compile-time constants 2014-03-13 10:07:01 +04:00
Natalia Ukhorskaya
36810c5bbb Move IS_PURE for constant inside CompileTimeConstant 2014-01-28 18:21:45 +04:00
Natalia Ukhorskaya
97da2def08 Record COMPILE_TIME_INITIALIZER for all final variables 2014-01-28 18:21:42 +04:00
Natalia Ukhorskaya
2ddda59465 Add tests for concatenation of strings 2014-01-28 18:21:41 +04:00
Natalia Ukhorskaya
cf5dc5b98b Fix EvaluateTests for strings 2014-01-28 18:21:41 +04:00
Natalia Ukhorskaya
73de3ae9ab Catch exceptions evaluating expression 2014-01-28 18:21:40 +04:00
Natalia Ukhorskaya
4329c42e3f Make unary minus and unary plus return int for byte and short 2013-12-23 13:46:00 +04:00
Natalia Ukhorskaya
27e602133d Small fixes after review: do not set is_pure=true for named constants refactoring 2013-12-05 15:23:41 +04:00
Natalia Ukhorskaya
e5a3518248 Parse longs with 'L' suffix. Report error if 'l' used. 2013-12-05 15:23:40 +04:00
Natalia Ukhorskaya
b6ce6c5e5a Parse floats with 'F' or 'f' suffix 2013-12-05 15:22:01 +04:00
Natalia Ukhorskaya
fb9a7e3c4c Create error value for division by zero 2013-12-05 15:22:00 +04:00
Natalia Ukhorskaya
2a023c16a9 Use type from compile time value for prefix expression 2013-12-05 15:21:55 +04:00
Natalia Ukhorskaya
9c176ddaa8 Warning for integer overflow 2013-12-05 15:21:55 +04:00
Natalia Ukhorskaya
d63f6843c8 Merge ConstantExpressionEvaluator and CompileTimeConstantResolver 2013-12-05 15:21:50 +04:00
Natalia Ukhorskaya
e6923ba29e create StringValue only for primitive compile time values 2013-12-05 15:20:23 +04:00