Commit Graph

11692 Commits

Author SHA1 Message Date
Svetlana Isakova dc51a2d238 analyze a lot of expressions in independent of context (expected type) mode 2013-09-03 13:09:05 +04:00
Svetlana Isakova fbd94a9507 rename ResolveMode to ContextDependency 2013-09-03 13:09:05 +04:00
Svetlana Isakova d26806a5ed update number value type properly 2013-09-03 13:09:04 +04:00
Svetlana Isakova 46b099c858 added deparenthesizeBinaryExpressionWithTypeRHS
param to deparenthesize
2013-09-03 13:09:04 +04:00
Svetlana Isakova c0f7a82b15 fixed result type for elvis operator
return type for special call for elvis operator might be nullable
but result is not nullable if the right type is not nullable
2013-09-03 13:09:04 +04:00
Svetlana Isakova 656597e0e2 removed obsolete code
selector of qualified expression can't be qualified expression itself
2013-09-03 13:09:04 +04:00
Svetlana Isakova 6429239f3f rewrote analyzing expression with type rhs
removed unnecessary temporary trace (and so extra 'getType' for left expression)
2013-09-03 13:09:03 +04:00
Svetlana Isakova 4caeadc0c1 added TemporaryResolutionResultsCache
to use cache when temporary traces are used
2013-09-03 13:09:03 +04:00
Svetlana Isakova ead5219001 assert added 2013-09-03 13:09:03 +04:00
Svetlana Isakova 7a757d2a51 changed type parameter name to special
when resolve special construction as a call
2013-09-03 13:09:02 +04:00
Svetlana Isakova 7b04755a59 through completion phase result type of call should be updated
with respect to being selector in safe call expression
2013-09-03 13:09:02 +04:00
Svetlana Isakova 4621fe6dfa resolve elvis operator as call 2013-09-03 13:09:02 +04:00
Svetlana Isakova 624eaa5aa8 refactoring: extracted 'visitElvisExpression' 2013-09-02 23:18:46 +04:00
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 8b7585af66 added diagnostic message tests to ensure that number value types don't appear in error messages 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 6641563044 Store files with the replaced version in separate folder to prevent putting them to artifacts 2013-09-02 15:31:06 +04:00
Nikolay Krasko e54784efcc Convert line separators when checking test results 2013-09-02 15:31:05 +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
Pavel Talanov e29c593c58 Fix check in JetQuickDocumentationProvider#isKotlinDeclaration
Always return true if we navigated to JetElement
2013-08-30 17:41:38 +04:00