Commit Graph

2162 Commits

Author SHA1 Message Date
Denis Zharkov 816c66063b Report special diagnostic when fake-call receiver is nullable
#KT-3602 Fixed
2016-02-02 08:17:49 +03:00
Denis Zharkov 9b3f557337 Report MEMBER_PROJECTED_OUT on calls with smart cast receiver
#KT-10856 Fixed
2016-02-02 08:17:48 +03:00
Mikhail Glukhikh d194af5c4e Correct report of NO_VALUE_FOR_PARAMETER when function call contains no brackets and lambda at the end #KT-7813 Fixed 2016-02-01 17:11:54 +03:00
Denis Zharkov e5f644a64a Temporary disable warning about unchecked reified argument
#KT-10847 Fixed
 #KT-6484 Reopened
2016-02-01 13:36:38 +03:00
Mikhail Glukhikh dcc6262f47 Regression test #KT-7804 Obsolete 2016-01-29 17:23:40 +03:00
Denis Zharkov 505dc61611 Treat extension receiver as noinline parameter
#KT-9574 Fixed
2016-01-29 14:36:53 +03:00
Denis Zharkov 2cd88b8cbc Make crossinline and noinline incompatible 2016-01-29 14:36:53 +03:00
Denis Zharkov 855a0b3493 Force type calculation for local function if it should be inferred
It helps to catch TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM errors
because they appear after return type calculation began

 #KT-6271 Fixed
 #KT-3272 Obsolete
2016-01-29 14:36:53 +03:00
Denis Zharkov 7d6310d88c Add test for obsolete issue
#KT-9571 Obsolete
2016-01-29 14:36:53 +03:00
Denis Zharkov 5b0fdcb3fe Fix stack overflow caused star projection 2016-01-29 14:36:53 +03:00
Mikhail Glukhikh 4691351e76 Fix for unprocessed lambda under not-null assertion #KT-10843 Fixed
Also #EA-76890 Fixed
2016-01-29 12:57:52 +03:00
Mikhail Glukhikh 767729ba2a Regression test #KT-9633 Obsolete 2016-01-29 10:55:22 +03:00
Dmitry Petrov 112e54b35a KT-10752: if (inferred) type for an expression refers to a Java class
non-accessible in the current context, it is a compiler error.
Otherwise we might generate a CHECKCAST instruction that causes IAE at run-time.
Here we are somewhat less permissive then Java
(see inaccessibleType.kt in diagnostics tests).
2016-01-29 10:30:00 +03:00
Ilya Gorbunov 911940d458 InlineOnly annotation suppresses NOTHING_TO_INLINE diagnostics. 2016-01-28 19:37:44 +03:00
Mikhail Glukhikh ed8ccdc15a Take into account data flow info changes for special call (if/when/elvis/!!) arguments #KT-10824 Fixed
Smart casts on complex expressions look as no more possible
2016-01-28 19:30:20 +03:00
Mikhail Glukhikh 7fd1f507e4 Additional catch for ReenteringLazyValueComputationException #KT-8448 Fixed
Also #EA-76264 Fixed
2016-01-28 17:52:33 +03:00
Mikhail Glukhikh 5062ce2804 Regression: correct smart cast from Type? to Type! 2016-01-28 17:08:15 +03:00
Mikhail Glukhikh 26a2319d7c ControlFlowBuilder.getExitPoint() now can return null if nothing was found #KT-10823 Fixed
Also #EA-73355 Fixed
2016-01-28 16:19:54 +03:00
Mikhail Glukhikh 069282cb6e Regression test #KT-8277 Can't Reproduce 2016-01-28 13:33:29 +03:00
Mikhail Glukhikh 12b100c541 Regression test #KT-9529 Obsolete 2016-01-28 12:56:12 +03:00
Denis Zharkov e69b115d9a Remove wrong assertion 2016-01-28 08:36:24 +03:00
Denis Zharkov 11a96ee8c8 Introduce not null type parameter capability
Java nullability annotations may generate types that currently are not denotable in Kotlin:
class Java {
  void <F> foo(@NotNull F f) {}
}

Type of given value parameter should be not nullable under any substitution:
String/String?/String! because of annotation contract.

NB: Currently there is no full analogues for such types in pure kotlin
2016-01-28 08:36:23 +03:00
Denis Zharkov c26ca5e7ef Turn on inference when resolving constructor super-calls
It's only needed when one of candidates has it's own type parameters
Otherwise it does not make sense as arguments are already specified
2016-01-28 08:35:18 +03:00
Denis Zharkov 6542d091ee Support generic constructors defined in Java
#KT-10686 Fixed
 #KT-10410 Fixed
2016-01-28 08:35:18 +03:00
Alexander Udalov 04026dbe84 Make Array<T>(size, init) a constructor of Array
It's not marked as inline, this is why 'crossinline' was added in
jaggedArray.kt/jaggedDeep.kt. Will be fixed in the following commits
2016-01-28 03:10:37 +03:00
Mikhail Glukhikh 7e26fa6002 One non-processed branch is now allowed for if statement #KT-10805 Fixed
Also #EA-64033 Fixed
2016-01-27 22:44:52 +03:00
Dmitry Petrov c5fd496cc9 Fix KT-10805 for 'when'. 2016-01-27 17:07:20 +03:00
Dmitry Petrov 9db3440e72 Fix type inference issues for 'if' and 'when'.
Use 'expectedType' (when present) as an explicit type argument for a special construct call.
Unfortunately, this approach can't be used for elvis due to other elvis-related inference hacks.
Fixes KT-10807, KT-10811.
This also affects KT-6189: now we can infer proper type for 'if'.

If type inference for special call failed, and we found no type errors in sub-expressions,
report TYPE_INFERENCE_FAILED_ON_SPECIAL_CONSTRUCT error.
This (and the hack above) fixes KT-10809: code no longer compiles.
2016-01-27 17:07:20 +03:00
Mikhail Glukhikh d94930149b Warning for open members in objects 2016-01-26 19:04:17 +03:00
Mikhail Glukhikh 1b8f938260 Report EXPOSED_PROPERTY_TYPE on a property name only #KT-10760 Fixed 2016-01-26 19:04:13 +03:00
Mikhail Glukhikh b1e3e1c32d A few forgotten checks added for objects (function members effective visibility, multiple varargs) #KT-10753 Fixed 2016-01-26 19:04:08 +03:00
Mikhail Glukhikh 22c0ddaa48 Destructuring declaration initializer now cannot use extension componentX() on nullable #KT-7794 Fixed 2016-01-26 19:03:28 +03:00
Mikhail Glukhikh 850dc89b38 For-loop now cannot use extension iterator on a nullable #KT-7428 Fixed 2016-01-26 19:03:23 +03:00
Denis Zharkov f560799bb7 Support top level wildcard types
#EA-73650 Fixed
2016-01-26 16:41:29 +03:00
Denis Zharkov 8ec63bd4dd Use type arguments from supertype when resolving constructor delegation call
#KT-3357 Fixed
2016-01-26 13:53:45 +03:00
Denis Zharkov 8b828f1d9a Use known type substitutor if it exists 2016-01-26 13:53:45 +03:00
Stanislav Erokhin e53e152f83 Removed hacks for code migration from ConstraintSystemImpl. 2016-01-25 21:53:09 +03:00
Stanislav Erokhin 210c9ab3db Minor. Added regression tests for: KT-3927, KT-9522, KT-10036, KT-7440, KT-9682, KT-9808, KT-9517, KT-9810, KT-9345. 2016-01-25 19:13:32 +03:00
Stanislav Erokhin 298a075381 Minor. removed functions which declared in Standard.kt from diagnostic testdata.
Removed declaration for functions: TODO, run, with, apply, let.
2016-01-25 19:13:31 +03:00
Stanislav Erokhin d7438d9f2b Add mock runtime to diagnostic tests.
Mock runtime contains function from file Standard.kt
2016-01-25 19:13:30 +03:00
Stanislav Erokhin f688b1b786 Relax rules for type parameters in property receivers 2016-01-22 22:18:57 +03:00
Denis Zharkov 6c0cd70a22 Introduce PureReifiable annotation
It prevents reporting unsafe substitution warning on expressions
like 'arrayOf(arrayOf(""))'
2016-01-22 19:17:22 +03:00
Denis Zharkov 4cf1393e81 Minor. Render annotations on type parameters 2016-01-22 19:17:22 +03:00
Denis Zharkov 70dc5b5403 Prohibit use of captured type as argument for reified parameter
#KT-8093 Fixed
2016-01-22 19:17:22 +03:00
Denis Zharkov 751f66c656 Report warning on generic type as argument for reified parameter
#KT-6484 Fixed
2016-01-22 19:17:22 +03:00
Denis Zharkov ae6c62ddff Minor. Report reified-related diagnostics on arguments if possible 2016-01-22 19:17:22 +03:00
Denis Zharkov a5c13ce8cf Approximate projections in SAM type when creating SAM adapter
Use the same approach as Java 8 applies to function types
(see non-wildcard parametrization in §9.9 of JLS)

 #KT-6918 Fixed
2016-01-22 19:17:22 +03:00
Denis Zharkov d87b13931d Create special type for missing dependencies when resolving annotations
#KT-10748 Fixed
2016-01-22 19:17:22 +03:00
Mikhail Glukhikh e9af4d25d0 Handling of try / catch / finally with 'Nothing' in all catch blocks #KT-10735 Fixed 2016-01-22 16:37:22 +03:00
Mikhail Glukhikh 366ab508e1 Data flow analysis: assignment of null makes variable effectively of type 'Nothing?' 2016-01-22 16:37:10 +03:00