Fixed KT-5985 Smart completion does not insert comma for constructor of nested data class

#KT-5985 Fixed
This commit is contained in:
Valentin Kipyatkov
2014-10-20 19:06:21 +04:00
parent f64f08c9b6
commit a84488f59a
3 changed files with 30 additions and 3 deletions
@@ -131,9 +131,18 @@ class ExpectedInfos(val bindingContext: BindingContext, val resolveSession: Reso
val callOperationNode: ASTNode?
if (parent is JetQualifiedExpression && callElement == parent.getSelectorExpression()) {
val receiverExpression = parent.getReceiverExpression()
val expressionType = bindingContext[BindingContext.EXPRESSION_TYPE, receiverExpression] ?: return null
receiver = ExpressionReceiver(receiverExpression, expressionType)
callOperationNode = parent.getOperationTokenNode()
val expressionType = bindingContext[BindingContext.EXPRESSION_TYPE, receiverExpression]
if (expressionType != null) {
receiver = ExpressionReceiver(receiverExpression, expressionType)
callOperationNode = parent.getOperationTokenNode()
}
else if (bindingContext[BindingContext.QUALIFIER, receiverExpression] != null) {
receiver = ReceiverValue.NO_RECEIVER
callOperationNode = null
}
else {
return null
}
}
else {
receiver = ReceiverValue.NO_RECEIVER
@@ -0,0 +1,9 @@
class Outer {
private data class Nested(val v: Int, val v2: Int)
fun foo(p: Int): Inner {
return Outer.Nested(<caret>)
}
}
// ELEMENT: p
@@ -0,0 +1,9 @@
class Outer {
private data class Nested(val v: Int, val v2: Int)
fun foo(p: Int): Inner {
return Outer.Nested(p, <caret>)
}
}
// ELEMENT: p