Commit Graph

486 Commits

Author SHA1 Message Date
Mikhail Glukhikh ed8ccdc15a Take into account data flow info changes for special call (if/when/elvis/!!) arguments #KT-10824 Fixed
Smart casts on complex expressions look as no more possible
2016-01-28 19:30:20 +03:00
Yan Zhulanow 3fa506fd45 "Inapplicable operator modifier" and "Inapplicable infix modifier" are now errors 2016-01-26 17:21:44 +03:00
Dmitry Petrov f371e67ce8 PatternMatchingTypingVisitor:
rewrite type inference for 'when' using special constructs.
This fixes several type inference issues for 'when':
KT-9929, KT-9972, KT-10439, KT-10463
along with some other diagnostics-related issues.
2016-01-22 10:41:55 +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
Pavel V. Talanov d72bc78550 Resolve annotations on parameters of function type 2016-01-20 18:06:23 +03:00
Pavel V. Talanov ce42d47383 Resolve lambda argument types when failing to resolve call 2016-01-19 14:14:33 +03:00
Mikhail Glukhikh 6157ebe3b8 Separate UNSAFE_IMPLICIT_INVOKE_CALL diagnostics introduced (see KT-8252) 2016-01-15 17:22:54 +03:00
Mikhail Glukhikh 0f80df7b2e initialDataFlowInfoForArguments introduced in CallExpressionResolver methods #KT-10175 Fixed 2016-01-15 17:22:42 +03:00
Pavel V. Talanov 9bfa90dc0e Analyze local variable declarations in expression position
Fixes exception on invalid code "val c = 1 < val Int.f: Int = 3"
2016-01-12 19:31:16 +03:00
Mikhail Glukhikh 0bcae4e0c0 Build fix: nullable exhaustiveness checker is now only a part of other exhaustiveness checkers 2016-01-12 15:44:55 +03:00
Mikhail Glukhikh 936fee0afa KT-10295: long enum (sealed) special case 2016-01-12 14:18:36 +03:00
Mikhail Glukhikh c085eb650f Better diagnostics for non-exhaustive whens, relevant test #KT-10295 Fixed 2016-01-12 14:18:23 +03:00
Michael Bogdanov 1d70b58d17 Fixed test data 2015-12-30 14:42:12 +03:00
Pavel V. Talanov 004c266433 Minor: fix missed error marker in test data 2015-12-29 18:13:10 +03:00
Pavel V. Talanov b38fc7b3c1 Parse local interfaces in expression position 2015-12-29 15:57:00 +03:00
Pavel V. Talanov 1c4d4f3e36 Create class descriptors for local classes in illegal positions
Typecheck code in illegal selector position
Fixes exceptions on "val p = A.class" erroneous code
2015-12-29 15:56:44 +03:00
Mikhail Glukhikh 0cc09872b6 Implicit exhaustive when annotation / highlighting 2015-12-26 10:46:44 +03:00
Pavel V. Talanov 6a1ca7b9c9 Fix an exception caused by objects literals in supertype list not considered local 2015-12-23 14:56:27 +03:00
Denis Zharkov 0d7c8635b3 Refine INSTANCE_ACCESS_BEFORE_SUPER_CALL check
- Detect usages of unitialized `this` as extension receiver argument
- Make it work within object literal created before super call

 #KT-9120 Fixed
 #KT-8289 Fixed
2015-12-17 19:56:38 +03:00
Mikhail Glukhikh f5989aa4f2 CallableMemberDescriptor.isOverridable / ClassDescriptor.isFinal refactoring
Extra JvmField and integer constants tests
2015-12-17 18:11:41 +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
Dmitry Jemerov 8db3fb03f9 remove support for "package.foo.bar" syntax inside files 2015-12-14 13:22:54 +01:00
Mikhail Glukhikh fe78f944a6 Private setter for open property: is now an error, not a warning 2015-12-11 18:54:40 +03:00
Alexander Udalov 239502368a Update test data for tower resolution algorithm
- locals win
- unary calls to plus/minus are not supported in favor of unaryPlus/unaryMinus
- unqualified nested classes are temporarily reported as unresolved
- function without receiver win against extension function
- explicit import win against star import
2015-12-11 17:01:02 +03:00
Mikhail Glukhikh d024045638 Data flow values for Elvis / parenthesized expressions, smart casts on them 2015-12-11 15:17:29 +03:00
Mikhail Glukhikh 745a3aeeac Accurate representation of smart casts on complex expressions 2015-12-11 15:17:25 +03:00
Dmitry Petrov 70c200d265 Fix diagnostic messages for properties.
Fix IDE tests.
Update quick fixes in IDE
(TODO: review new inheritance-related diagnostics with regards to quick fixes)
2015-12-09 17:43:48 +03:00
Dmitry Jemerov e97e82d119 use terms "lambda expression" and "anonymous function" instead of "function literal" and "function expression" 2015-12-09 13:55:40 +01:00
Alexander Udalov b1fa740341 Do not report "inconsistent bounds" when there are repeated bounds
Also slightly refactor DeclarationsChecker#checkSupertypesForConsistency
2015-12-07 15:47:47 +03:00
Alexander Udalov 5fbb9bfe3b Report error on repeated upper bounds for type parameters 2015-12-07 15:47:47 +03:00
Alexander Udalov 21e64e02bd Report error on more than one class bound for type parameters
Such code may behave unexpectedly when compiled to JVM
2015-12-07 15:47:47 +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 46f4191185 Unnecessary safe call is now reported in CallExpressionResolver, removed code duplication for safe call receivers
See also KT-10175
2015-11-25 16:19:48 +03:00
Mikhail Glukhikh dc60c62781 Enum.values is now deprecated but Enum.values() is no more deprecated 2015-11-23 17:29:36 +03:00
Mikhail Glukhikh 1c609663a4 Private setters are now deprecated for open properties 2015-11-23 17:29:23 +03:00
Ilya Gorbunov 5b02a59cb7 Fix JvmStatic applicability diagnostics test after COMPANION_OBJECT became distinct KotlinTarget 2015-11-21 00:43:35 +03:00
Pavel V. Talanov aebcebe8ca Add simple checker tests for scripts 2015-11-19 22:56:55 +03:00
Mikhail Glukhikh 811ba8110f Implicit receiver smart casts implementation and highlighting 2015-11-17 10:26:42 +03:00
Mikhail Glukhikh 03287d5d66 Diagnostics corrected for smart cast impossible 2015-11-17 10:26:26 +03:00
Ilya Gorbunov 5f675c55ed Fix deprecated ranges and range member usages in tests. 2015-11-11 03:53:42 +03:00
Pavel V. Talanov f5c4f82971 Fix exception from backend in light classes mode for null passed as annotation argument 2015-11-10 14:30:50 +03:00
Mikhail Glukhikh 2d9fbf5696 Always null detection 2015-11-09 16:36:34 +03:00
Valentin Kipyatkov 52dc23012f Changed parsing of object and enum entries to drop "KtObjectDeclarationName" 2015-11-05 23:21:22 +03:00
Mikhail Glukhikh 41ebfd025e More precise diagnostics of smart cast impossible #KT-7240 Fixed 2015-11-03 13:38:51 +03:00
Mikhail Glukhikh 0a5a5a2e36 More precise diagnostics is added for smart cast impossible #KT-8810 Fixed 2015-11-03 11:15:58 +03:00
Dmitry Petrov 09f0b3fe87 KT-9721:
- Kotlin/JS still uses package facades.
Handle them properly in StubClassBuilder parentStack.
- Generate backend-related diagnostics in IDE
using light class generation for file facades.
- Drop PackageFacadeStubCache.
2015-10-26 19:37:52 +03:00
Mikhail Glukhikh d6988ad69e Get rid of FIELD_IDENTIFIER at syntax level, two errors dropped, a set of tests fixed / deleted #KT-9539 Fixed 2015-10-21 16:36:55 +03:00
Mikhail Glukhikh 3151d4ca9d Check of type parameter bounds consistency #KT-9438 Fixed 2015-10-20 11:02:19 +03:00
Dmitry Petrov 8c64279419 Drop package facades: fix testData in duplicate JVM signature test
(declaration origins are now ordered alphabetically)
2015-10-19 16:03:20 +03:00
Yan Zhulanow b2470a6aad Report warning on unary plus()/minus() 2015-10-19 11:51:54 +03:00