Commit Graph

11701 Commits

Author SHA1 Message Date
Svetlana Isakova a6162cf5ba fixed: dataFlowInfoForArguments was not set in call candidate context 2013-09-03 13:09:08 +04:00
Svetlana Isakova 52848f6aa4 Use temporary cache when resolve function literals twice 2013-09-03 13:09:08 +04:00
Svetlana Isakova 7fce75bc1f removed unnecessary parameter
resolve argument without temporary trace
(it's resolved and put to call trace in the beginning anyway)
2013-09-03 13:09:08 +04:00
Svetlana Isakova 30b0a72c6b analyze all arguments with unknown expected type
in the beginning of call resolution process
2013-09-03 13:09:07 +04:00
Svetlana Isakova c8fc2c882d refactoring: extracted method 'getTypeOfLastExpressionInBlock' 2013-09-03 13:09:07 +04:00
Svetlana Isakova 33ab7a3789 added UNIT_EXPECTED_TYPE
use it for coercion to unit instead of repeating analysis twice
2013-09-03 13:09:07 +04:00
Svetlana Isakova 756cb3759b fixed: use function placeholder when there is no declared value parameter list
(not when there is no value parameters)
2013-09-03 13:09:06 +04:00
Svetlana Isakova 358c1d6f71 fixed ArrayIndexOutOfBoundsException in quick fix util
(in 'getParameterCorrespondingToValueArgumentPassedInCall')
2013-09-03 13:09:06 +04:00
Svetlana Isakova 623c6e50e1 removed unused method 2013-09-03 13:09:06 +04:00
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