Commit Graph

96 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 6735cc8937 [FIR] Implement new bound smartcast algorithm
#KT-36055 Fixed
2020-02-12 10:17:45 +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
Pavel Kirpichenkov 396b226462 [NI] Restore missing smart casts after another smart cast in call
Expression type serves as a part of a key for retrieving smart cast info.
Rewriting expression type with SmartCastManager leads to incorrect processing of following smartcasts for same expression, therefore it was removed.

KT-32507 Fixed
KT-32358 Fixed
2020-01-15 14:39:40 +03:00
Pavel Kirpichenkov a1ad680edb [NI] Disallow full completion based on lower Nothing constraint 2019-12-25 14:59:06 +03:00
Dmitriy Novozhilov 7fed7a840b [NI] Update some testdata broken in NI 2019-12-20 11:17:47 +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 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
Mikhail Zarechenskiy c458393e2f [NI] Do not avoid trivial constraints if they aren't from upper bounds
Since we skipped trivial constraint with `Any?` from parameter type of
 function `equals`, the compiler thought that there is no proper
 constraints (upper bounds do not matter here) and marked resolved
 call as a failed one, then diagnostic about missing equals was added

 Also, tune `TrivialConstraintTypeInferenceOracle` for `Any?`-like
 constraints

 #KT-30724 Fixed
2019-04-02 12:21:14 +03:00
Mikhail Zarechenskiy ca894a6a71 [NI] Don't complete nested call if there's no constraints at all 2019-03-25 12:17:28 +03:00
Dmitriy Novozhilov 9825984bc5 [NI] Update test data for diagnostic tests 2019-03-25 12:17:27 +03:00
Mikhail Zarechenskiy 9b3e17f0d7 [NI] Avoid building controversial systems by clipping extra constraints
#KT-23854 Fixed
2019-03-04 11:29:38 +03:00
victor.petukhov 46bd5ba107 Add alphabetical sorting diagnostics with same ranges 2019-02-14 12:31:42 +03:00
Mikhail Zarechenskiy 3afd4a2f4a [NI] Record all diagnostics from subcalls resolution results 2018-02-14 14:58:04 +03:00
Dmitry Savvinov 33f9576dd1 [NI] Turn off KnownTypeParameterSubstitutor for NI
The main consequence of it is that TYPE_MISMATCH range for control
structures became wider.

Also, for extra safety, don't change behaviour of OI.
2017-12-07 14:05:42 +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
Dmitry Neverov cd24adac32 Detect redundant 'is' check
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00
Dmitry Petrov 5021be351d KT-15878 Extension shadowed by member shouldn't be reported for infix/operator extensions when member is non-infix/operator 2017-01-23 16:46:43 +03:00
Dmitry Petrov 954204da82 KT-1560
Report warning on extensions shadowed by members.
2017-01-16 17:25:13 +03:00
Ilya Gorbunov d943079557 Exception typealiases rendering in test output 2016-08-17 12:40:50 +03:00
Alexander Udalov 1339286261 Drop undocumented absolute name specification feature with 'package.' 2016-06-01 19:30:03 +03:00
Ilya Gorbunov f4822cd757 Fix testData in compiler: add collections and ranges package to fq-names. 2016-01-22 05:54:38 +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
Ilya Gorbunov 4dde59368c Fix tests not to duplicate array constructor definitions as they are available now in builtins. 2015-12-14 04:29:18 +03:00
Mikhail Glukhikh 89e56093a2 Limit "always null" scope: only for !!, is and dot; senseless comparison rolled back; "smart constant" information for nulls #KT-10029 Fixed 2015-11-25 18:26:08 +03:00
Mikhail Glukhikh b468d5b0c6 No smart casts to Nothing? 2015-11-09 16:36:37 +03:00
Mikhail Glukhikh 2d9fbf5696 Always null detection 2015-11-09 16:36:34 +03:00
Mikhail Glukhikh b556037915 Smart casts to nothing after comparison with null 2015-11-06 10:57:06 +03:00
Alexey Tsvetkov 1e2256207c Update test data 2015-10-19 20:45:02 +03:00
Denis Zharkov f0e3fd617d Adjust testData to CharSequence.length transformation 2015-10-14 20:39:35 +03:00
Alexey Tsvetkov 5449cea6b7 Make Array type parameter T non-reified 2015-10-14 18:36:53 +03:00
Yan Zhulanow 1b01e7a85a Fix tests ('infix') 2015-10-07 15:50:23 +03:00
Yan Zhulanow 6db9344659 Fix compiler tests 2015-09-25 19:20:20 +03:00
Stanislav Erokhin 8efbf4fc32 Fixed testdata -- removed package import 2015-09-18 21:00:20 +03:00
Denis Zharkov 4850fd10f0 Regenerate test data containing rendered descriptors
Introduced '@' after each annotation
2015-09-18 10:14:39 +03:00
Michael Nedzelsky bc5c9065d2 fix tests in org.jetbrains.kotlin.checkers 2015-09-08 02:04:32 +03:00
Pavel V. Talanov d2592e4a2c Companion objects have public visibility by default
#KT-7114 Fixed
2015-06-02 16:23:03 +03:00
Valentin Kipyatkov aefe0dd192 Changed highlighting range and attributes of useless elvis operator 2015-06-02 14:35:19 +03:00
Mikhail Glukhikh dea2ec9da6 When now tries to smart cast subject to not-null if contains no null case #KT-7857 Fixed
Some new tests + some fixed tests
2015-06-02 10:56:21 +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
Pavel V. Talanov 06916d98c6 default -> companion: replace all mentions of default and default object 2015-03-17 15:47:39 +03:00
Pavel V. Talanov 59f192ef90 Replace 'class object' with 'default object' in renderers and test data
Includes changes to decompiled text
Old syntax is used in builtins and project code for now
2015-03-06 19:36:54 +03:00
Pavel V. Talanov 7b837e2631 Updata test data: txt files for diagnostics tests 2015-02-16 15:38:36 +03:00
Valentin Kipyatkov a383a82ddd No subpackages of current package resolved by short name 2014-12-26 16:23:19 +03:00
Denis Zharkov 654411a0b0 Refactored tests using Array constructor:
Some moved to tests with stdlib
Some changed to use arrayOfNulls
2014-12-11 16:04:03 +03:00