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
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
Dmitry Jemerov
8db3fb03f9
remove support for "package.foo.bar" syntax inside files
2015-12-14 13:22:54 +01:00
Denis Zharkov
871fe7680b
Load special override as HIDDEN in case of signature clash
...
#KT-10151 Fixed
2015-12-11 22:41:03 +03:00
Mikhail Glukhikh
00504a3f6d
Private setter for open property: take containing class modality into account #KT-10325 Fixed
2015-12-11 18:54:28 +03:00
Stanislav Erokhin
39b6637c7c
Fix exception from InvokeProcessor when we get invoke from extension function type.
2015-12-11 17:01:04 +03:00
Stanislav Erokhin
66a031f7a0
Do not enter in recursion for implicit invoke on variable with un inferred type
2015-12-11 17:01:01 +03:00
Mikhail Glukhikh
6fb871a088
A set of additional tests for complex expressions DFA
2015-12-11 15:17:37 +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
Mikhail Glukhikh
7cd867b936
DFA: take into account if / else and when expression assignments #KT-10002 Fixed
...
Also #KT-7479 Fixed
2015-12-11 15:17:22 +03:00
Zalim Bashorov
5bf8b4d946
Allow to use "static" part of class in own constructors by short name, including in primary constructor
2015-12-09 21:42:32 +03:00
Mikhail Glukhikh
c73f01927a
'sealed' is now not 'final' by default + related code changes #KT-10266 Fixed
2015-12-09 19:19:04 +03:00
Dmitry Petrov
94bea54db3
Change "most specific return type" definition for fake overrides.
...
Given overridden descriptors D = d[i].
1. Find D*, subset of D:
returnType(d* from D*) <: returnType(d) for each d from D.
Always prefer var to val.
2. Prefer non-flexible return type to flexible.
Check for var/val overrides properly
(NB: this will report PROPERTY_TYPE_MISMATCH_ON_OVERRIDE
for all properties, not just overrides involving vars as it was before).
2015-12-09 17:43:48 +03:00
Dmitry Petrov
594039ac42
Delegation and overrides:
...
- Tests.
- No need for a separate diagnostic message regarding
return/property type conflict on override by delegation:
it is always a conflict of inherited signatures.
2015-12-09 17:43:48 +03:00
Dmitry Petrov
ef72c594c4
KT-1934 & KT-10197:
...
Naive approximation for fake overriding signature:
use upper bound for flexible types.
Check delegation errors.
2015-12-09 17:43:47 +03:00
Dmitry Petrov
135c30323b
KT-1934 Check inherited signatures for compatibility
...
Overridden signatures should have compatible return types
(equal types for 'var').
Only relevant overrides should be taken into account.
Refactor inherited signatures check,
introduce a strategy interface for problem reporting.
2015-12-09 17:43:47 +03:00
Nikolay Krasko
3374ac7606
Minor: More tests for warnings suppression
2015-12-09 16:01:52 +03:00
Denis Zharkov
ecac0f177b
Fix order of type parameters loaded from PSI
...
#KT-10285 Fixed
2015-12-08 15:46:34 +03:00
Mikhail Glukhikh
57b3bc0496
Regression: getPredictableNullability for unnecessary safe call check #KT-10276 Fixed
2015-12-08 11:23:35 +03:00
Mikhail Glukhikh
5c9e55f3fb
DFA bug fix: assignment of unstable to stable uses predictable type set (see test)
2015-12-08 10:13:38 +03:00
Mikhail Glukhikh
2e73bcb3a6
DFA bug fix: assignment of unstable to stable uses predictable nullability (see test)
2015-12-08 10:13:34 +03:00
Alexander Udalov
2dce7ad1e2
Add test on "inconsistent type parameter bounds"
...
It seems that all tests on that diagnostic were replaced in previous commits by
"repeated bound" and "no other bounds except a type parameter bound"
diagnostics
2015-12-07 15:47:47 +03:00
Alexander Udalov
d3c17ec337
Report error when type parameter has a type parameter bound and any other bound
...
To prevent issues with erasure on JVM: it's unclear what such type parameter
should be erased to
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
5729855e4f
Type parameter as result type: more precise expected type definition #KT-5385 Fixed
...
Tests for KT-5385 KT-10223 KT-7800 KT-7817 + something related
2015-12-04 19:00:24 +03:00
Denis Zharkov
95cecdbc42
Support overrides of generic methods with erased version in Java
2015-12-03 18:19:36 +03:00
Denis Zharkov
4f06cece37
Refactor external overidability conditions
...
Before this change they could only negatively affect on result
Now they may force success result
Also refine overridavility condition for java fields:
two java fields having the same name are seen as overrides even
if they have different type
2015-12-03 18:19:36 +03:00
Denis Zharkov
8838e46578
Do not create KotlinTypeImpl with error scope while erasing
...
See assertion in KotlinTypeImpl init block
2015-12-03 18:19:36 +03:00
Denis Zharkov
e2b51f30ed
Extract 'doSubstitute' parameters into SubstitutionConfiguration
2015-12-03 18:19:36 +03:00
Mikhail Glukhikh
ea3a65d0b8
Additional tests for KT-10243
2015-12-02 18:14:59 +03:00
Mikhail Glukhikh
60e457167d
Creating deep copy of local function declaration instructions in CFA, regression test #KT-10243 Fixed
2015-12-01 23:40:50 +03:00
Dmitry Petrov
1a3a296827
KT-10139: any if without else used in expression is an error
...
regardless of expected type: it can't be an expression, even of type Unit.
#KT-10139 Fixed
2015-12-01 10:36:40 +03:00
Andrey Breslav
45db5db7e8
Forbid prefixes and suffixes for numeric literals
2015-11-30 19:36:33 +03:00
Andrey Breslav
8544a5ab5f
Remove "This" keyword
2015-11-30 19:36:33 +03:00
Mikhail Glukhikh
fe04cc513b
Original type is taken into account when intersecting possible types in resolve #KT-10232 Fixed
2015-11-30 19:09:44 +03:00
Mikhail Glukhikh
c6be69a483
No more reified types for catch parameter #KT-9742 Fixed
2015-11-30 15:24:24 +03:00
Mikhail Glukhikh
8788d8e2d5
Call chains: receiver data flow info is dropped for extensions with nullable receiver #KT-10056 Fixed
2015-11-27 20:23:25 +03:00
Michael Nedzelsky
2fa34ae170
KT-9883 prohibit using spread operator for nullable value
...
#KT-9883 Fixed
2015-11-26 19:42:34 +03:00
Stanislav Erokhin
63fa71606f
Create new Tower Resolve
2015-11-26 16:21:49 +03:00
Dmitry Petrov
9ccb1fd506
KT-9601, KT-10103:
...
Chose maximally specific function in callable reference
#KT-9601 Fixed
#KT-10103 Fixed
2015-11-26 12:52:12 +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
Dmitry Petrov
da90c21284
Warn about comma-separated conditions in when without argument.
...
See KT-5143.
2015-11-25 15:39:23 +03:00
Mikhail Glukhikh
b9e9c47b28
Using of enum entries as types is now forbidden #KT-5401 Fixed
2015-11-25 13:33:16 +03:00
Mikhail Glukhikh
284c1b2ec5
Local sealed classes are deprecated
2015-11-23 17:29:16 +03:00
Pavel V. Talanov
2b955bc6ec
Script refactoring, frontend tests: changes according to semantic changes in scripts
...
Add checker tests for scripts
2015-11-19 22:56:57 +03:00
Dmitry Petrov
42b587b0d5
Prohibit callable references to annotation class constructors.
...
See KT-4391.
2015-11-19 18:31:20 +03:00
Mikhail Glukhikh
3a4f6d8226
Smart cast impossible on when subject is no more recorded #KT-10061 Fixed
2015-11-18 18:02:59 +03:00
Alexander Udalov
e50eb50299
Make getNestedTypeVariables() an utility
2015-11-18 16:40:44 +03:00