Commit Graph

11 Commits

Author SHA1 Message Date
Alexander Udalov d8c5b0236d Fix incorrect usage of mapReturnType in param assertions 2013-12-30 04:15:24 +04:00
Alexey Sedunov 1f8d42ab49 Fix nullability check (in case of explicitly nullable types constructed from ype variables) 2013-02-13 18:23:37 +04:00
Evgeny Gerashchenko b9e5704057 Updated test data and stdlib sources. 2013-02-13 18:08:37 +04:00
Alexander Udalov 90d255e7da Simplify tests on not-null assertions
No need to call blackBoxFile() on a useless test data file. Also creating
environment logic is simplified
2013-02-11 02:01:41 +04:00
Alexander Udalov 9df3c22097 Kill blackBoxFile()
If your test is supposed to use blackBoxFile(), maybe it should be placed into
box/boxWithStdlib directory
2013-02-11 02:01:41 +04:00
Alexander Udalov 1f4dd8cd33 Add CodegenUtil.isNullableType(), fix assertions
JetType.isNullable() is not accurate when the type denotes a type parameter:
a parameter can be not null (isNullable=false), but its upper bound can be
nullable (<T: Any?>), so null may appear in the value of such type. Therefore
it's preferred to use a special check (isNullableType()) in codegen from now on

Do not generate assertion for parameters of not-null types which have a
nullable upper bound + the same with Java method calls

Also fix Intrinsics class internal name in tests

 #KT-3313 Fixed
2013-02-05 21:52:29 +04:00
Alexander Udalov 8eb6047972 Fix assertions generation for substituted members 2013-02-05 16:26:56 +04:00
Alexander Udalov c9984c3d06 Generate not-null assertions on method parameters
Intrinsics.checkParameterIsNotNull() gets its caller's class and method names
from the stack trace to render them in an exception message.

Fix codegen tests because now it's now allowed to pass null to non-null
argument in tests
2012-10-08 19:13:20 +04:00
Alexander Udalov bf779b4ca5 Generate not-null assertions only for descriptors coming from Java
Introduce BindingContext.IS_DECLARED_IN_JAVA, store that info in
JavaDescriptorResolver
2012-10-08 19:03:29 +04:00
Alexander Udalov fcbc95bbb4 Generate not-null assertions after getting a field 2012-10-08 14:11:57 +04:00
Alexander Udalov 95ec2448eb Generate not-null assertions after method calls
If a method comes from Java and is annotated as returning NotNull, after
calling it we should check if it actually returned something other than null.
Introduce checkReturnedValueIsNotNull() in jet/runtime/Intrinsics which does
exactly that.

CallableMethod's invoke() and invokeDefault() are now private, use asserted
versions instead
2012-10-08 14:11:56 +04:00