Commit Graph

83 Commits

Author SHA1 Message Date
Pavel Kirpichenkov 2d21b82501 [NI] Remove hack for special functions
Treating special functions for `if`, `when`, `try`, `?:` as not accepting `Nothing` result type is incorrect.
Making so leads to cases with uninferred `Nothing` result type for inner calls and lost data flow info.
2019-12-27 18:40:42 +03:00
Dmitriy Novozhilov d210df9ea3 Update spec testdata according to previous commits 2019-12-26 17:43:28 +03:00
Denis Zharkov 0b385cc532 NI: Approximate captured-for-star-projections to *
^KT-35602 Fixed
2019-12-26 12:35:32 +03:00
Pavel Kirpichenkov 77e4212774 [minor] unmute fixed spec tests 2019-12-25 14:59:06 +03:00
Pavel Kirpichenkov 7ee71450bc [NI] Discriminate Nothing? result type from nullability constraints
Nullability constraints should not be chosen when proper
argument constraints for variables in contravariant position present.

^KT-32106 Fixed
^KT-33166 Fixed
2019-12-25 14:59:06 +03:00
Mikhail Zarechenskiy ae1630f376 [NI] Don't discriminate Nothing-type from resulting ones
^KT-32106 Fixed
2019-12-25 14:59:04 +03:00
victor.petukhov be8ae24713 Temporary mute some spec tests through apply changes after 45e881f03f 2019-12-25 12:44:54 +03:00
Nikolay Krasko e99dc0f87f Show only unique diagnostics in psi checker (KT-35578)
MissingDependencyClassChecker.collectDiagnostics now show only unique diagnostics

As per-file analyzer trace used in checker delegates to resolve session trace, diagnostics might be duplicated because of race condition:
 1. If a non-checker thread performs analyze first, diagnostics for global elements will be stored in the resolve session trace only once.
 2 If the checker threads comes to the analyze first, diagnostics will be stored in the local trace, and after that might be duplicated in the resolve session trace by other analyzers.

 #KT-35578 Fixed
2019-12-20 02:39:05 +03:00
Mikhail Zarechenskiy e0fb586aaf [NI] Don't loose diagnostic after type variable fixation
#KT-24488 Fixed
2019-10-31 11:32:02 +03:00
Mikhail Zarechenskiy 932d84d568 Fix performance regression in NI by fixing totally incorrect hashCode
The actual problem was introduced in 4f1e85b468, note how `hashCode` is implemented:
```
var currentHashCode = cachedHashCode
if (currentHashCode == 0) return currentHashCode
...
```
It's a silly bug, there should be check `if (currentHashCode != 0) ...` because `0` is used a marker for "uncomputed value".

Now, in the commit 0219b86d06 I added map with `KotlinType` as a key and because of constant `hash` for `KotlinType`, we basically got `List` instead of `Map`, which caused this performance regression

 #KT-34063 Fixed
2019-09-30 10:22:30 +03:00
victor.petukhov aa79064a96 Remove deprecated spec tests map generators 2019-08-30 11:39:09 +03:00
victor.petukhov d8e5b068d5 Relinking spec tests 2019-08-19 18:31:46 +03:00
victor.petukhov 8465d690f1 Add spec tests for 'Type system' (introduction and 'kotlin.Any' type) 2019-08-19 18:31:45 +03:00
victor.petukhov cf692fb257 Implement tests map generator and refactor folder structure to spec tests linking 2019-08-19 18:31:40 +03:00
victor.petukhov 28da325a11 Actualize DFA spec tests 2019-08-19 18:31:39 +03:00
Dmitriy Novozhilov 9f90486893 [Misc] Update spec testData according changes in NI 2019-07-30 12:41:41 +03:00
Denis Zharkov daa27016ca [Invariant Fix] Adjust DataFlowValue::Identifier for refinement
After refinement is introduced it becomes possible to have a different
descriptors instances for effectively the same descriptors

Also, it accidentally fixes KT-25432 because is caused by a different
version of descriptors created for NewCapturedType

^KT-25432 Fixed
2019-07-30 12:41:38 +03:00
Mikhail Zarechenskiy 8fe632f52b [NI] Record DFI for callable reference arguments
#KT-31941 Fixed
2019-06-17 19:18:04 +03:00
Mikhail Zarechenskiy d9dca067f6 [NI] Propagate non-null info on supertypes for capturing from bounds
#KT-31941 Fixed
2019-06-13 00:57:51 +03:00
Mikhail Zarechenskiy 787a8bb9bd Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit 7c4101e21c.

 #KT-31866 Fixed
 #KT-31868 Fixed
 #EA-125401 Fixed
 #KT-25290 Open
2019-06-07 12:31:38 +03:00
Dmitry Savvinov 4f6d0ca1d1 Update missed tesdata
Was missed after 7daf12fa6d
2019-05-30 18:58:12 +03:00
Dmitry Savvinov 7daf12fa6d [Testing] Remove duplicate logic, clean-up CheckerTestUtil 2019-05-30 12:32:39 +03:00
Dmitriy Novozhilov e574106799 [NI] Support @OnlyInputTypes annotation. #KT-29307 fixed 2019-05-29 10:54:41 +03:00
Dmitriy Novozhilov 7c4101e21c [NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI 2019-05-29 10:35:46 +03:00
Mikhail Zarechenskiy 848640253a Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit f20ec3e0a6.
2019-05-29 01:31:28 +03:00
Dmitriy Novozhilov f20ec3e0a6 [NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI
There is added a new service named `SubstitutingScopeProvider`, that
  provides factory that creates captured types and approximator for them.
  In OI they are the same as before commit, for NI they are empty, because
  that approximation interferes with NI algorithm

That service is injected into function descriptors and property descriptors
  and used for creating `SubstitutingScope` with correct services

Also there is changed time when we approximate captured types in NI
  (after all call checkers)

#KT-25290 Fixed
2019-05-28 11:18:33 +03:00
Dmitriy Novozhilov b4c8c79931 [NI] Add check for non-null argument type in arguments check
#KT-31461 Fixed
2019-05-23 12:22:42 +03:00
Dmitriy Novozhilov b323298b0e [NI] Remove deep types in commosn super type for recursive types
#KT-30411 Fixed
2019-05-23 12:22:42 +03:00
victor.petukhov d4515031de Report warning about implicitly inferred nothing only for return position
^KT-31535 Fixed
2019-05-22 15:45:59 +03:00
victor.petukhov 8bdc5f981e Actualize spec tests 2019-05-16 12:24:18 +03:00
Mikhail Zarechenskiy 1e3db9ee7c [NI] Update test data for diagnostic tests 2019-04-25 16:19:37 +03:00
victor.petukhov a567aa620b Fix headers in box and parsing spec tests 2019-04-19 11:55:30 +03:00
victor.petukhov 86bb5d689d Add various tests for DFA testing 2019-04-19 11:55:30 +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
Dmitriy Novozhilov a26df4b4c6 [NI] Update test data for spec tests 2019-03-25 23:04:50 +03:00
Dmitriy Novozhilov ca0e66bafc [NI] Refactor compiler representation of integer literals types
Add `IntegerLiteralTypeConstructor` that holds types, that can take
  integer literal with given value. It has two supertypes
  (`Number` and `Comparable<IntegerLiteralType>`) and have
  special rules for subtyping, `intersect` and `commonSuperType`
  functions with primitive number:

Example (assuming that ILT holds Int type):
* ILT <: Int
* Int :> ILT
* ILT intersect Int = Int
* commonSuperType(ILT, Int) = Int

#KT-30293 Fixed
#KT-30446 Fixed
2019-03-25 18:55:36 +03:00
victor.petukhov 70c35f4186 Introduce warning about implicitly inferred Nothing as a type parameter
^KT-20849 Fixed
2019-03-15 19:28:38 +03:00
Dmitriy Novozhilov 77c98bef4d Fix recursion in contract declaration analysis. KT-26386 Fixed
Issue fixed only in old inference
2019-03-07 14:35:18 +03:00
Dmitriy Novozhilov d0462859bf Minor. Fix reporting diagnostic in contract with callable reference 2019-03-07 14:35:13 +03:00
Dmitriy Novozhilov 2f5843f764 Move detecting of illegal call of contract function into call checker
(#KT-26153, #KT-26191) fixed
2019-03-01 14:50:46 +03:00
Dmitriy Novozhilov 54e5cce9be Prohibit declaring multiple callsInPlace contract on same lambda.
#KT-26150 fixed
2019-03-01 14:50:46 +03:00
Dmitriy Novozhilov 84da8b6279 Report CONTRACT_NOT_ALLOWED diagnostic on extension property getter/setter
KT-27090
2019-03-01 14:50:46 +03:00
victor.petukhov bd03ecf4a0 Rename helper file with typealias samples for spec tests 2019-02-28 14:55:41 +03:00
victor.petukhov 2bcdadf17f Add positive diagnostic tests for smartcasts from nullability condition using if expression 2019-02-14 13:11:14 +03:00
victor.petukhov 06b5a42d0d Improve test exceptions fixation:
- exceptions is analyzed if it's specified explicitly only,
- compute test case number for diagnostic tests in which an exception is thrown.
2019-02-14 12:31:43 +03:00
victor.petukhov ec8a6cbe9c Alphabetical sort wrapped intersection types for rendered diagnostics 2019-02-14 12:31:43 +03:00
victor.petukhov acd6d354dc Support several spec places to which tests are linked and require specify spec version for each test 2019-02-14 12:31:43 +03:00
victor.petukhov 46bd5ba107 Add alphabetical sorting diagnostics with same ranges 2019-02-14 12:31:42 +03:00