Commit Graph

6003 Commits

Author SHA1 Message Date
Svetlana Isakova aba70e047d resolve a!! as call 2013-09-02 23:18:46 +04:00
Svetlana Isakova 46cb6b3242 complete resolve for array access expression 2013-09-02 23:18:45 +04:00
Svetlana Isakova 051055896d update recorded EXPRESSION_TYPE of call expression
after type parameter inference completion
2013-09-02 23:18:45 +04:00
Svetlana Isakova e2f681c587 report type mismatch deeply on branches for if
in type argument inference case
2013-09-02 23:18:45 +04:00
Svetlana Isakova c5b6ee4df3 added 'commonSupertypeForPossiblyNumberTypes' 2013-09-02 23:18:45 +04:00
Svetlana Isakova e4325cd92d resolve argument of 'if' call
with right data flow info
2013-09-02 23:18:45 +04:00
Svetlana Isakova e37af4de67 added DataFlowInfoForArguments param to contexts 2013-09-02 23:18:45 +04:00
Svetlana Isakova 99bb6f13b5 data flow info for arg may affect next argument's type for type argument inference case 2013-09-02 23:18:45 +04:00
Svetlana Isakova 9ccd1e5ddd added DataFlowInfoForArguments
data flow info for argument depends on previous argument analysis
special interface was added to support case with argument types inference
and 'if' (with special data flow info for then and else arguments)
2013-09-02 23:18:45 +04:00
Svetlana Isakova 27cff93ed8 use data flow info in constraint system
intersect data flow value possible types
add intersection type (or exact type for the most cases) as a lower bound to constraint system

always get common super type for intersection type as a result
(avoid returning it, even in error messages)
2013-09-02 23:18:45 +04:00
Svetlana Isakova b91846eb5d resolve 'if' as call when expected type is unknown 2013-09-02 23:18:44 +04:00
Svetlana Isakova 9eda531eea refactoring: extracted method 'reportTypeInferenceExpectedTypeMismatch'
to reuse it later from 'tracing for if'
changed required/found types order in message to synchronize it with 'TYPE_MISMATCH' error
2013-09-02 23:18:44 +04:00
Svetlana Isakova 5d2ae9aec5 added ability to resolve call with uncustomary tracing strategy
(necessary for special 'tracing for if')
2013-09-02 23:18:44 +04:00
Svetlana Isakova 7842327d20 added 'getDataFlowInfoForValueArgument' to ResolvedCall interface 2013-09-02 23:18:44 +04:00
Svetlana Isakova 9938c58354 check all upper bounds even if there are some error types in bounds
for cases like 'val l:List<Int> = id(newList())'
List<???> is a lower bound for id's type parameter here
2013-09-02 23:18:44 +04:00
Svetlana Isakova eb1c29b507 removed code duplication
extracted 'getTypeInfoWhenOnlyOneBranchIsPresent'
2013-09-02 23:18:44 +04:00
Svetlana Isakova 0609f61ee7 added test for nontrivial nested calls 2013-09-02 23:18:44 +04:00
Svetlana Isakova 919714e027 refactoring: extracted methods
from 'completeNestedCallsInference'
2013-09-02 23:18:44 +04:00
Svetlana Isakova 0849798af0 report only 'The value is out of range'
not 'An integer literal does not conform to the expected type Int/Long'
2013-09-02 23:18:44 +04:00
Svetlana Isakova f2746b835e report ERROR_COMPILE_TIME_VALUE for constants instead of TYPE_MISMATCH
(functionality returned)
2013-09-02 23:18:44 +04:00
Svetlana Isakova 6bb768892f added todo comment 2013-09-02 23:18:43 +04:00
Svetlana Isakova fa1740a26e changed way to compute common supertype for number types
(using only supertypes, not exact value)
2013-09-02 23:18:43 +04:00
Svetlana Isakova fccfa0051e added DoubleValueTypeConstructor
no need to store exact value in IntegerValueTypeConstructor, it was removed
2013-09-02 23:18:43 +04:00
Svetlana Isakova 80eb45b793 process number value types properly in constraint system
the case when type parameter has number value types (constants) as lower bounds
should be handled specially, because upper bound for primitive number types is 'Number',
but by default we want Int (or Long)
2013-09-02 23:18:43 +04:00
Svetlana Isakova 517c24c8f6 added UNKNOWN_EXPECTED_TYPE, NumberValueTypeConstructor
analyze function arguments with UNKNOWN_EXPECTED_TYPE
(for several times in different traces yet)

for number literals create type with NumberValueTypeConstructor with exact value,
transform it to the corresponding type when resolve arguments (expected type is known)

doesn't work properly for if, elvis operator, etc. (throws exceptions)
2013-09-02 23:18:43 +04:00
Svetlana Isakova 8d0573f448 added 'isDenotable' flag to TypeConstructor 2013-09-02 23:18:43 +04:00
Svetlana Isakova d1a21bfd3e changed comparison to NO_EXPECTED_TYPE to
'noExpectedType' invocation
2013-09-02 23:18:43 +04:00
Svetlana Isakova 0eed0c6c7f extracted 'getResultingCall' method
rewrote 'getResultingType' in terms of it
2013-09-02 23:18:43 +04:00
Svetlana Isakova 2eadd5202d check argument types through complete phase
with right data flow info
2013-09-02 23:18:42 +04:00
Svetlana Isakova 4f2df78066 analyze all function arguments without expected types
arguments are now analyzed for several times, for each resolution candidate;
the goal is to analyze them once

todo (don't work properly):
 - number literals
 - if/when expressions
2013-09-02 23:18:42 +04:00
Svetlana Isakova 543e0343c5 moved ResolveMode, ResolutionResultsCache
from CallResolutionContext to ResolutionContext
2013-09-02 23:18:42 +04:00
Nikolay Krasko 215e736d65 Enable debug for slice rewrite in delegation traces 2013-09-02 15:31:04 +04:00
Evgeny Gerashchenko 440716c817 Updated to IDEA 132.27 EAP. 2013-08-30 21:08:23 +04:00
develar 3ab095a4f5 JS backend: started to implement source maps
#KT-927 in progress

(cherry picked from commits 5543cda, 6ed296b, 11186f9, 5b84d0b)
2013-08-30 13:17:20 +04:00
Andrey Breslav 323bbe00cc Constants moved to the top 2013-08-29 20:30:33 +04:00
Natalia.Ukhorskaya fa4d771a94 Merge remote-tracking branch 'origin/pr/303' 2013-08-29 19:44:08 +04:00
Mohammad Shamsi 32c34a3740 KT-3893 Fixed
- Added modifier check for parameters in constructors.
- Added modifier check for parameters in functions.
- Added modifier check for parameters in try/catch
2013-08-29 22:08:26 +08:00
Alexander Udalov 9e7aa69eb7 Resurrect JetValueParameter
Its name() and type() methods are still used in Kara (the latter just to check
if the type is nullable, so only the first character is needed)
2013-08-29 16:48:09 +04:00
Alexander Udalov d84ab4423f Support enums as annotation arguments in deserialized Kotlin descriptors 2013-08-29 16:48:09 +04:00
Alexander Udalov de062274e9 Extract getEnumEntriesScope utility method 2013-08-29 16:48:09 +04:00
Andrey Breslav 87293a8831 Navigation to invoke() from {}
Example:

foo <caret>{}
2013-08-28 15:26:47 +04:00
Andrey Breslav a53986e1d6 Navigation to iterator(), next(), hasNext() through 'in' in for-loops 2013-08-28 14:46:58 +04:00
Andrey Breslav b7153d7398 Common methods related to references are pulled up 2013-08-28 13:57:56 +04:00
Andrey Breslav 7c3e30775a More information in the assertion message 2013-08-28 13:49:52 +04:00
Andrey Breslav e53d1773ae Support navigation to get/set methods of a property delegate, if they are in the source code 2013-08-28 13:49:52 +04:00
Andrey Breslav ff13ba87ac Code simplified 2013-08-28 13:49:52 +04:00
Pavel V. Talanov 7920321e3d Do not try to write KotlinPackage annotation if package class is not generated 2013-08-27 19:03:04 +04:00
Andrey Breslav 3002ac96f0 Supported converting member properties to extensions
Additionally, we now generate <selection>throw UnsupportedOperationException()</selection> when a missing body is added
2013-08-27 15:03:27 +04:00
Andrey Breslav c02f0a7d04 Intention to convert a member to an extension 2013-08-27 15:03:27 +04:00
Andrey Breslav ca3d7f9780 Assertion message 2013-08-27 15:03:27 +04:00