Commit Graph

99 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
Mikhail Glukhikh e3721ed406 [FIR] Implement bare type modification with known type arguments 2020-02-11 16:09:21 +03:00
Mikhail Glukhikh 5c6341b4e4 [FIR] Handle fully qualified expressions separately in tower resolver 2020-01-13 13:26:13 +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 9891f562cc [NI] Make subtyping algorithm more robust to error types
During subtyping/incorporation we transform types (e.g. changing nullability,
 form of the type) and, basically, we're doing this to some FIXPOINT.
 It's important that we use `KotlinType.hashCode()` to compare types, but
 for error types hashCode is a hashCode of its supertype and, for example,
 `makeNullableAsSpecified` method recreate type every time. So, we continue
 to generate new constraints and we'll never stop incorporation algorithm
2018-06-07 15:45:53 +03:00
Dmitry Savvinov 2d8e4e752c Fallback to Any type in case supertypes are empty
This can happen e.g. if all supertypes were on the cycle (A : B, B : A)
-- then SupertypesLoopChecker will cut all supertypes that are on cycle,
leaving set of supertypes empty.

Some clients in the compiler are not ready to work with empty list of
supertypes -- notably, CommonSupertypes.

^KT-23029 Fixed
2018-04-10 17:25:43 +03:00
Dmitry Savvinov ea72c76a37 [NI] Testdata changes after fixes in error types 2017-12-07 12:49:56 +03:00
Mikhail Zarechenskiy 328c67b9e8 Add separate diagnostic renderer results for tests with NI 2017-11-29 02:54:30 +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 Savvinov 58b815d842 Fix false USELESS_CAST in function with expression body
Note that current behaviour is made similar to the case with
properties initializers/accessors, which means that more complex
cases are not covered yet (see KT-20801) #KT-20802 fixed.
2017-10-19 18:21:56 +03:00
Dmitry Savvinov a1778a7da8 Fix CAST_NEVER_SUCCEEDS when casting Nothing to some type 2017-10-19 18:21:56 +03:00
baratynskiy 01883a41cb javac-wrapper: refactoring, fixes and tests 2017-08-29 18:01:36 +03:00
Mikhail Zarechenskiy ae3497c6ce Reduce highlighting range for UNCHECKED_CAST
#KT-18985 Fixed
2017-08-07 18:49:58 +03:00
Mikhail Zarechenskiy ac8fbce249 Fix false "useless cast" when target type is flexible
#KT-17820 Fixed
2017-05-15 11:24:39 +03:00
Dmitry Neverov cd24adac32 Detect redundant 'is' check
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00
Mikhail Zarechenskiy 7f287a4230 Support warning about useless cast on safe cast
#KT-13348 Fixed
2017-04-10 12:48:09 +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
Mikhail Zarechenskiy 0d6b7bb6a1 Prohibit check for instance of a non-reified, non-subtype type parameter
#KT-12683 Fixed
 #KT-9986 Fixed
2017-04-05 21:35:07 +03:00
Mikhail Zarechenskiy f518e8ebb8 Prefer stable types to diagnose useless cast
#KT-11622 Fixed
2017-04-05 21:35:05 +03:00
Mikhail Zarechenskiy 13eddba1f2 Fix false warning about useless cast in property and property accessor
Note that there are some other problems, for example:
`val a = if (true) 1 as Number else 2`, here we'll get useless cast

 #KT-9551 Fixed
 #KT-9645 Fixed
2017-04-05 21:35:04 +03:00
Mikhail Zarechenskiy 12db3a263e Don't report useless cast in lambda if it has influence on return type
#KT-15161 Fixed
 #KT-12690 Fixed
2017-04-05 21:30:32 +03:00
Mikhail Zarechenskiy bff9ebc0d5 Fix check for instance for types with compatible upper bounds
#KT-5246 Fixed
2017-04-03 16:25:32 +03:00
Denis Zharkov 257417bc4a Minor. Lower type aliase declarations priority
There are several reasons for doing this:
- See org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberScope.computeDescriptors,
  classifiers are being deserialized in the last turn, so it's necessary to preserve consistent order
- Their priority should be close to classes
2016-09-09 10:27:35 +03:00
Mikhail Glukhikh d21061ff60 CAST_NEVER_SUCCEEDS: some type alias tests (1.1 only!) 2016-08-10 12:23:09 +03:00
Mikhail Glukhikh 687698da9a Do not report USELESS_CAST when casting null to nullable (special case) 2016-08-10 12:23:02 +03:00
Mikhail Glukhikh 098520de64 CAST_NEVER_SUCCEEDS: do not report when casting nullable to nullable #KT-260 Fixed 2016-08-10 12:22:53 +03:00
Mikhail Glukhikh b56e84d47f Cast never succeeds: special 'Nothing' / 'Nothing?' case
(cherry picked from commit 63435b4)
2016-07-27 10:52:13 +03:00
Mikhail Glukhikh a902c4901a CAST_NEVER_SUCCEED: replace subtyping check with subclassing check #KT-13206 Fixed
(cherry picked from commit 5fc797a)
2016-07-27 10:51:13 +03:00
Mikhail Glukhikh dbbc4ec281 Array<Subtype> can be now cast to Array<Supertype(?)> without CAST_NEVER_SUCCEEDS #KT-6391 Fixed
(cherry picked from commit 2629d55)
2016-07-21 20:16:06 +03:00
Mikhail Glukhikh 90e5e561e3 KT-6391: Arrays with same erased types counted as cast-compatible now
(cherry picked from commit 9e6f4bf)
2016-07-21 20:15:55 +03:00
Mikhail Glukhikh 4b6b35dadf Type parameter is considered capable of taking any value for the purpose of cast possibility check #KT-6611 Fixed 2016-06-08 15:25:34 +03:00
phx402@gmail.com 75e9e35669 Fixed incorrect "No cast needed" warning when casting from extension function to regular one and vise versa
#KT-11780 Fixed
2016-05-13 13:40:14 +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
Mikhail Glukhikh 49e7417741 "as" in binary / unary expressions now checked only for original type conversion #KT-10384 Fixed
Also #KT-10386 Fixed
2015-12-15 12:02:33 +03:00
Yan Zhulanow a3ff3ffc45 Fix tests: "Placing function type parameters after the function name" error 2015-11-27 15:51:11 +03:00
Ilya Gorbunov 21f509511c Fix CharSequence parameter names in testData 2015-11-21 07:09:05 +03:00
Denis Zharkov 1305d9755a Transform CharSequence.length to property 2015-10-14 20:39:29 +03:00
Alexey Tsvetkov 5449cea6b7 Make Array type parameter T non-reified 2015-10-14 18:36:53 +03:00
Alexey Tsvetkov 62c25c0370 Replace is Array<T> with .isArrayOf<T>() 2015-10-14 18:36:53 +03:00
Andrey Breslav a2e5e60c68 TRAIT -> INTERFACE in diagnostics 2015-10-12 14:36:38 +03:00
Denis Zharkov 6f4579213c Adjust rendered descriptors after remove/charAt transformations 2015-10-11 19:59:30 +03:00
Dmitry Jemerov 7c20630272 diagnostics for deprecated syntax of function type parameter list 2015-10-06 16:20:47 +02: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
Alexander Udalov 1a3209e1dc Drop traits with required classes
#KT-4771 Rejected
2015-06-17 16:23:58 +03:00
Pavel V. Talanov d2592e4a2c Companion objects have public visibility by default
#KT-7114 Fixed
2015-06-02 16:23:03 +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