Commit Graph

73 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
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
850dc89b38 For-loop now cannot use extension iterator on a nullable #KT-7428 Fixed 2016-01-26 19:03:23 +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
Dmitry Petrov
f371e67ce8 PatternMatchingTypingVisitor:
rewrite type inference for 'when' using special constructs.
This fixes several type inference issues for 'when':
KT-9929, KT-9972, KT-10439, KT-10463
along with some other diagnostics-related issues.
2016-01-22 10:41:55 +03:00
Dmitry Petrov
0c52960d7a KT-10706: do not report IMPLICIT_CAST_TO_ANY on expressions of type Nothing 2016-01-19 10:50:09 +03:00
Dmitry Petrov
609ffc10a9 KT-10322, KT-10646, KT-10647:
- update diagnostic to (supposedly) more useful
- also report IMPLICIT_CAST_TO_ANY if expected type is DONT_CARE
 (effectively "no expected type" for lambda expression).
2016-01-14 10:08:20 +03:00
Dmitry Petrov
f54de08073 KT-10646, KT-10647:
Move IMPLICIT_CAST_TO_UNIT_OR_ANY to ControlFlowInformationProvider
(where checks for 'if' and 'when' used as expressions are performed).
2016-01-14 10:08:20 +03:00
Alexander Udalov
75f046fa81 Drop Throwable#printStackTrace, make it a JVM-specific extension 2015-12-25 20:16:18 +03:00
Dmitry Jemerov
e97e82d119 use terms "lambda expression" and "anonymous function" instead of "function literal" and "function expression" 2015-12-09 13:55:40 +01:00
Dmitry Petrov
76931affc6 KT-10139:
Non-exhaustive 'when' without 'else' used in expression is an error
regardless of expected type: it can't be an expression, even of type Unit.
2015-12-01 10:36:40 +03:00
Dmitry Petrov
1a3a296827 KT-10139: any if without else used in expression is an error
regardless of expected type: it can't be an expression, even of type Unit.

 #KT-10139 Fixed
2015-12-01 10:36:40 +03:00
Mikhail Glukhikh
de37cb8f40 Generic types may not extend kotlin.Throwable #KT-9816 Fixed 2015-11-30 15:24:32 +03:00
Mikhail Glukhikh
c6be69a483 No more reified types for catch parameter #KT-9742 Fixed 2015-11-30 15:24:24 +03:00
Michael Nedzelsky
e6a2bd05d4 fix KT-9652 Warning to specify expected type as Any? when it is already Any?
#KT-9652 Fixed
2015-11-06 06:32:07 +03:00
Anton Sukhonosenko
141ffa27dc val / var are now forbidden on a loop multi declaration parameter #KT-6274 Fixed
VAL_OR_VAR_ON_LOOP_MULTI_PARAMETER error added
KtValVarKeywordOwner interface added for PSIs that have getValOrVarKeyword method
2015-11-03 15:30:50 +03:00
Svetlana Isakova
06e90cf6a1 Annotated the return type of 'elvis' function with @Exact
fun <T> ELVIS(T?, T): @Exact T
2015-10-22 21:55:12 +03:00
Yan Zhulanow
e14c9645dc Error on 'if' without an 'else' branch when used as an expression 2015-10-19 03:56:15 +03:00
Yan Zhulanow
6db9344659 Fix compiler tests 2015-09-25 19:20:20 +03:00
Michael Nedzelsky
bc5c9065d2 fix tests in org.jetbrains.kotlin.checkers 2015-09-08 02:04:32 +03:00
Svetlana Isakova
fe34d1673e Exception 'Base expression was not processed: function literal' fixed 2015-09-07 17:05:40 +03:00
Valentin Kipyatkov
7edff172a2 KT-1273 Unused assignment - should highlight assignment instead of expression
#KT-1273 Fixed
2015-05-19 23:45:59 +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
Dmitry Jemerov
f374eec8f1 deprecating types after colon 2015-04-29 16:33:24 +02:00
Denis Zharkov
44a55e5bf6 Adjust testData to new labels syntax 2015-04-29 14:03:11 +03:00
Andrey Breslav
c61a29d4f5 KT-6774 Cannot find equals() when comparing with null
#KT-6774 Fixed
2015-02-16 18:50:09 +03:00
Svetlana Isakova
a2f03f2d52 Fix: constraint T? >: Int! should transform to T >: Int 2015-01-30 13:33:37 +03:00
Evgeny Gerashchenko
897854b3dc KT-6671 Report unused constructor parameters
#KT-6671 fixed
2015-01-27 22:38:27 +03:00
Andrey Breslav
0eee83b6ec Lazy logs removed 2014-11-21 18:59:45 +03:00
Svetlana Isakova
2a83053355 Updated lazy log tests 2014-11-21 14:02:45 +03:00
Stanislav Erokhin
b7c473f59e Update lazy.log files 2014-11-17 17:45:01 +03:00
Alexander Udalov
4f0d83a7fe Update lazy logs after field rename 2014-11-11 18:35:39 +03:00
Andrey Breslav
4892369cf4 Diagnostic tests are logging their lazy activity 2014-11-10 17:24:04 +02:00
Alexander Udalov
3a8ad45dec Append newline to EOF for .txt test data files
Reverts and fixes 102f0d3
2014-10-21 03:18:27 +04:00
Svetlana Isakova
ce01c61811 Rename: auto cast -> smart cast 2014-10-01 18:52:52 +04:00
Nikolay Krasko
e796f88b38 Regenerate test data with constructed descriptors for diagnostics tests 2014-09-18 17:58:23 +04:00
Alexey Sedunov
9fee8600cb Pseudocode: Do not generate implicit return instruction inside of
Unit-typed lambdas
 #KT-5549 Fixed
2014-08-05 18:14:40 +04:00
Alexey Sedunov
9cbcabffa4 Control-Flow Analysis: Reuse pseudo-value information for unused expression analysis 2014-07-28 13:07:37 +04:00
Svetlana Isakova
79cec6411d Mark only unreachable parts of element if it has reachable parts
like for 'return todo()' mark only 'return'
2014-06-21 12:26:33 +04:00
Tuomas Tynkkynen
3e451c5811 Disallow break or continue across a function boundary
Code containing breaks or continues that attempt to jump across a
function boundary weren't detected during analysis but would crash
the compiler during code generation. Add diagnostics for these kinds
of errors.

Example:

fun f() {
    while (true) {
        fun inner() {
            continue
        }
    }
}

 #KT-4334 Fixed
2014-02-26 00:14:42 +02:00
Svetlana Isakova
400e6d3f44 KT-4310 Check for definite returns
#KT-4310 Fixed
2013-12-17 19:04:40 +04:00
Alexander Udalov
9e5c68a8f9 Fix KotlinBuiltIns.isUnit
It didn't check type's nullability
2013-12-12 21:38:20 +04:00
Svetlana Isakova
c30259dfbe added info about smart casts to diagnostic tests 2013-12-11 19:53:50 +04:00
Alexander Udalov
4cd4026174 Support empty if-statements
Type-check "if (...) ;" to Unit, report "implicit cast to Unit", propagate data
flow info out of its condition

 #KT-2478 Fixed
2013-12-04 15:19:47 +04:00
Svetlana Isakova
a3f9cef354 fixed bug: 'isStatement' for function body == 'hasBlockBody'
not vice versa
2013-09-30 21:06:05 +04:00
Andrey Breslav
69cc11d035 Existing tests updated according to "'Else' is not required in 'when' if Unit is expected" 2013-09-13 22:05:37 +02:00
Svetlana Isakova
298d344c31 check constants with Unit return type as usual 2013-09-13 16:04:17 +04:00
Svetlana Isakova
335e0d7d1b test data fixed
can't implicitly convert to Unit any more in 'if'
as 'if' is resolved as special function call 'fun IF<T>(T, T)'
2013-09-03 13:09:17 +04:00
Svetlana Isakova
aba70e047d resolve a!! as call 2013-09-02 23:18:46 +04:00