Commit Graph

142 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 8dd9d98129 [FIR] Implement checker for exhaustive when's in expression position 2021-02-09 16:04:40 +03:00
eugenpolytechnic a564f92eef FIR: introduce ThrowableSubclassChecker 2021-02-05 09:22:12 +03:00
eugenpolytechnic 5c0231b727 FIR: introduce CatchParameterChecker 2021-02-01 15:07:13 +03:00
Mikhail Glukhikh 7d4eaefd36 FIR: report UNSAFE_CALL on dot when possible 2021-01-29 16:55:26 +03:00
Jinseong Jeon e72ddbcbfe FIR checker: differentiate UNSAFE_CALL from INAPPLICABLE_CANDIDATE
To do so, inside the root cause of inapplicable candidate errors,
we will record expected/actual type of receiver, if any.
That will help identifying inapplicable calls on nullable receiver.
2021-01-29 16:54:23 +03:00
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov f283f2db43 [FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00
Mikhail Zarechenskiy 100a6f70ca Relax rules about inferring to Nothing for special calls
#KT-37388 Fixed
 #KT-38427 Fixed
 #KT-39953 Fixed
 #KT-38899 Fixed
2020-07-16 09:56:46 +03:00
simon.ogorodnik f573719cc1 [FIR] Fix missing receiver type if anonymous function without label 2020-04-08 14:56:17 +03:00
Mikhail Glukhikh b27152f903 Replace some FIR syntax errors with more proper diagnostics 2020-03-27 16:46:59 +03:00
Denis Zharkov cdd7e41891 FIR: Support proper implicit return type computation for local classes 2020-03-25 14:53:34 +03:00
Mikhail Glukhikh 8884cbe415 Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed 2020-03-05 09:39:40 +03:00
Ilya Chernikov 6356807997 Reapply "Only create descriptors for candidates with lambda args"
#KT-36247 fixed
A lot of testdata changed because significanly less (error) descriptors
are created for unresolved types, so diagnostics became different.
2020-02-14 11:41:30 +01:00
Dmitriy Novozhilov 5ceb68f19f [FIR-TEST] Update some testdata 2020-02-10 10:54:04 +03:00
Mikhail Glukhikh 64c7ab1302 [FIR] Fix lambda resolve in independent context 2020-02-04 15:00:12 +03:00
Dmitriy Novozhilov 5cb7cf040a Update some testdata according switching compiler to 1.4 2020-01-20 16:41:46 +03:00
Mikhail Glukhikh 5c6341b4e4 [FIR] Handle fully qualified expressions separately in tower resolver 2020-01-13 13:26:13 +03:00
Dmitriy Novozhilov 0c01499d98 [NI] Improve completing calls with multiple postponed arguments
#KT-27999 Fixed
#KT-30244 Fixed
#KT-31102 Fixed
2019-12-26 10:53:03 +03:00
Dmitriy Novozhilov e730965bc5 [NI] Approximate intersection type in type argument to star if it's necessary
#KT-32196 Fixed
2019-12-20 11:33:06 +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 ca8da22569 [NI] Improve CST algorithm to handle non-fixed variables
#KT-32456 Fixed
 #KT-32423 Fixed
 #KT-32818 Fixed
 #KT-33197 Fixed
2019-10-31 11:32:00 +03:00
Dmitriy Novozhilov c8d087d744 [FIR] Tests. Save failed tests into testdata 2019-09-16 10:58:51 +03:00
victor.petukhov bfeb9537ee Exclude functional types for the warning reporting about implicitly inferred a type parameter to Nothing 2019-06-21 15:52:01 +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 f702417655 [NI] Relax rules for call completion: require at least one constraint
It's enough to have at least one good constraint.

 Note that the whole algorithm can be a bit more general:
 we could check also Out<T>, In<T> and verify that T has good only
 lower constraint or upper constraint, but there are questions for
 types like Inv<Out<T>>, where T should have lower and upper constraints

 #KT-31514 Fixed
2019-05-29 02:14:00 +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
victor.petukhov d4515031de Report warning about implicitly inferred nothing only for return position
^KT-31535 Fixed
2019-05-22 15:45:59 +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 c283e15425 [NI] Preserve annotations during type substitution
#KT-31346 Fixed
2019-05-08 11:26:20 +03:00
Dmitriy Novozhilov e70bdb51c5 [NI] Automatically squash equal diagnostics in OI and NI in testdata 2019-04-19 10:53:19 +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 9825984bc5 [NI] Update test data for diagnostic tests 2019-03-25 12:17:27 +03:00
Dmitriy Novozhilov b07aed7a00 [NI] Fix determination of completion mode. #KT-30406 Fixed 2019-03-15 10:39:50 +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
Dmitriy Novozhilov a236ad5686 NI: resolve try catch as synthetic function call (#KT-25435 fixed) 2019-02-17 12:46:11 +03:00
victor.petukhov 30762a450a Wrap diagnostic parameters to double quotes and split by comma instead of semicolon 2019-02-14 12:31:42 +03:00
victor.petukhov 46bd5ba107 Add alphabetical sorting diagnostics with same ranges 2019-02-14 12:31:42 +03:00
Mikhail Glukhikh f3555daa60 Report UNUSED_PARAMETER on main parameter in 1.3+ #KT-26999 Fixed 2018-10-25 19:10:39 +03:00
Dmitry Petrov df6d4f358a KT-22274 report warning on labels that can't be referenced
Labels are meaningful only if they can be referenced by 'break',
'continue', or 'return' expressions.
2018-07-25 12:08:20 +03:00
Dmitry Petrov 6fb913a463 KT-22274 report error/warning on incorrect return target label 2018-07-25 12:08:20 +03:00
Mikhail Zarechenskiy 612baacc25 Make useless elvis diagnostic more consistent for new and old inference
Also, remove diagnostics that can be covered by usual USELESS_ELVIS diagnostic
2018-04-12 14:38:55 +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
Dmitry Savvinov 816d89e393 [NI] Improved testdata after changes in applicabilities
This commits introduces testdata changes, where NI behaviour strictly
improved, after several previous fixes.

For some tests, just WITH_NEW_INFERENCE directive was added. It
indicates, that some of previous commits first introduced error in that
test, and then some other commit fixed it (netting no overall testdata
change). It is preferrably to keep those annotations until we will
migrate to NI completely, to prevent unexpected regressions.
2017-12-07 12:49:56 +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
Stanislav Erokhin 4c456983eb Fix javac tests (add separate descriptor rendering) 2017-10-05 15:11:45 +03:00
Dmitry Petrov 3405ae30a1 Inner classes of generic classes can't extend Throwable
Do it in the same way as Java: prohibit inner classes (including
anonymous inner classes) capturing type parameters from outer classes
(but not outer methods) extending Throwable.

See KT-17981:
- Deprecated in 1.2
- Error in 1.3
2017-10-04 12:43:50 +03:00
baratynskiy 01883a41cb javac-wrapper: refactoring, fixes and tests 2017-08-29 18:01:36 +03:00