Commit Graph

38 Commits

Author SHA1 Message Date
Mikhail Glukhikh 8884cbe415 Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed 2020-03-05 09:39:40 +03:00
Pavel Kirpichenkov b161839092 [NI] Report unsafe implicit invoke accordingly to OI
This reverts commit df046683cc.
KT-30695
2020-02-14 18:06:34 +03:00
Pavel Kirpichenkov df046683cc Revert "[NI] Report unsafe implicit invoke accordingly to OI"
This reverts commit b045adf83a.
2020-02-13 16:06:40 +03:00
Pavel Kirpichenkov b045adf83a [NI] Report unsafe implicit invoke accordingly to OI
There are several issues with unsafe desugaring for convention calls.
Proper fix is not implemented here (see design proposal KT-30872).
This commit only applies the old logic in the new inference.
^KT-30695 Fixed
2020-02-13 14:49:43 +03:00
simon.ogorodnik 34e6649d31 [FIR] Harden check of argument type properly
Before this commit, nullable argument could match not null parameter.
Now we require also correct nullability that breaks some cases
2020-02-03 16:45:18 +03:00
Denis Zharkov 47ecaa5b06 FIR: Fix scope intersection types
Otherwise overload resolution ambiguity is reported in the test
2020-01-30 17:12:50 +03:00
Dmitriy Novozhilov 57a1342aac [FIR] Fix creating DefinitelyNotNullTypes
Also fix substitutions to them
2020-01-28 14:14:21 +03:00
Dmitriy Novozhilov 2536fa0cd5 [FIR-TEST] Add new testdata generated after changes in previous commit 2019-12-12 16:11:46 +03:00
Mikhail Zarechenskiy 516fccbe7b [NI] Complete call if return type contains only "good" type variables 2019-05-08 12:19:52 +03:00
Mikhail Zarechenskiy bcc8802014 [NI] Avoid constraints from expected type for effectively empty system
Expression will be checked against expected type later.

 Theoretically, this is not very good, but it aligns with the old
 inference, plus it helps avoiding multiple type mismatch diagnostics.
2019-04-17 12:55:12 +03:00
Dmitriy Novozhilov 18f9272f56 [NI] Fix reporting smartcast diagnostics for intersection types
#KT-30826 Fixed
2019-04-12 17:36:59 +03:00
Dmitriy Novozhilov a92cf19641 Revert "[NI] Fix reporting smartcast diagnostics for intersection types"
This reverts commit 033d7262

That commit breaks bootstraping
2019-04-11 18:49:02 +03:00
Dmitriy Novozhilov 033d7262a2 [NI] Fix reporting smartcast diagnostics for intersection types
#KT-30826 Fixed
2019-04-11 18:10:59 +03:00
Mikhail Zarechenskiy 6ebbb6eae3 [NI] Fix not-null smartcast on intersection of nullable types
#KT-28670 Fixed
2018-12-11 11:29:59 +03:00
Mikhail Zarechenskiy 7b108541a9 [NI] Add test for obsolete issue
It was fixed after c6712ff861

 #KT-25182 Obsolete
2018-11-23 17:30:37 +03:00
Mikhail Zarechenskiy c6712ff861 [NI] Correctly compute definitely not null type for intersection one
{ T : Any? & Foo & Bar? }!! -> { T!! & Foo & Bar }

 Also, fix bug with loosing non-representative number type.
 For example, for type { Byte & SomeType } we lost type `Byte` because
 `getDefaultPrimitiveNumberType` returns null for it

 Fixes #KT-28334 for NI
2018-11-22 18:10:37 +03:00
Mikhail Zarechenskiy 021732f74a [NI] Consider type non-nullable only if it has non-null supertype
Fixes #KT-12684 for NI
2018-11-12 12:42:03 +03:00
Mikhail Zarechenskiy 145c04e7e2 [NI] Fix substitution of incorporation constraint type 2018-01-30 13:00:40 +03:00
Mikhail Zarechenskiy b2299ed19f [NI] Fix testdata after introducing DefinitelyNotNull types 2017-12-06 18:36:16 +03:00
Mikhail Zarechenskiy 8757298994 Add diagnostics to test data from NI 2017-11-29 02:54:26 +03:00
Mikhail Zarechenskiy a71238bf94 Place !WITH_NEW_INFERENCE directive to diagnostics test data 2017-11-29 02:53:49 +03:00
Mikhail Zarechenskiy 90a8a164b4 Fix false warning about check for instance of nullable type
#KT-12269 Fixed
2017-04-05 21:35:09 +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
Mikhail Glukhikh b3c5760eb5 Type intersection fix: T & (final A) is no more calculated as just A #KT-7801 Fixed 2016-01-22 16:37:04 +03:00
Mikhail Glukhikh 6157ebe3b8 Separate UNSAFE_IMPLICIT_INVOKE_CALL diagnostics introduced (see KT-8252) 2016-01-15 17:22:54 +03:00
Denis Zharkov b4bb92d136 Fix overload resolution ambiguity for types intersection
There are two different forms of types intestion:
1. Type parameters with multiple bounds
2. Smart casts

The problem was that when member scope of type intersection contained
effective duplicates and that lead to overload resolution ambiguity in
strange cases like `x.hashCode()`

For first type we do effectively the same thing as when building member
scope for class extending several interfaces: group all descriptors by
both-way-overridability relation and then choose most-specific in each
group.

For smart casts we do basically the same thing but with special
treatments:
1. From all descriptors that _equal_ to most specific we choose
   the one that works without smartcast if possible (i.e. we choose first from candidates list)
2. If smart-cast value seems to be unstable we use only member scope
   of receiver type + all descriptors from smart cast possible types
   that has incompatible signature. If we'd include all of them and
   choose one as more specific, and it would lead to false
   SMART_CAST_IMPOSIBLE (see test unstableSmartCast.kt)

 #KT-3996 Fixed
 #KT-10315 Fixed
2015-12-15 16:18:31 +03:00
Mikhail Glukhikh fe04cc513b Original type is taken into account when intersecting possible types in resolve #KT-10232 Fixed 2015-11-30 19:09:44 +03:00
Mikhail Glukhikh 811ba8110f Implicit receiver smart casts implementation and highlighting 2015-11-17 10:26:42 +03:00
Michael Nedzelsky c318a13e6c Error on using extension function type as an upper bound 2015-11-06 06:31:52 +03:00
Stanislav Erokhin 7d7d37719b Forbidden old invokeExtension convention. 2015-10-17 14:45:53 +03:00
Michael Nedzelsky 57205f5721 drop BASE_WITH_NULLABLE_UPPER_BOUND 2015-10-14 20:51:01 +03:00
Denis Zharkov f0e3fd617d Adjust testData to CharSequence.length transformation 2015-10-14 20:39:35 +03:00
Michael Nedzelsky bc5c9065d2 fix tests in org.jetbrains.kotlin.checkers 2015-09-08 02:04:32 +03:00
Denis Zharkov 5e09a0c2c9 Add some test cases after review 2015-08-28 18:50:25 +03:00
Denis Zharkov b471767e03 Refine smart cast check for type parameters 2015-08-28 18:50:25 +03:00
Denis Zharkov aad977d204 Properly check whether nullability of receiver argument fits to parameter's nullability
It's should behave like we check isSubtype(receiverType, parameterType) + use nullability info from smart cast

 #KT-1090 Fixed
2015-08-28 18:50:25 +03:00
Denis Zharkov 6ecfa6e985 Refine subtyping check: pay attention to corresponding supertype nullability
F: Any, T : F? => !isSubtype(T, Any)

It helps to identify upper bounds violation like in KT-7455

 #KT-7455 Fixed
 #KT-2924 Fixed
 #KT-3015 Fixed
2015-08-28 18:50:25 +03:00
Denis Zharkov a906be6dd7 Prohibit using null as a value of generic type
#KT-7350 Fixed
 #KT-7736 Fixed
 #KT-7485 Fixed
2015-08-28 18:50:25 +03:00