Skip to content

Commit

Permalink
Ensured stubs are properly created for table fields whose index
Browse files Browse the repository at this point in the history
type is unable to be inferred during IJ indexing.
  • Loading branch information
Benjamin-Dobell committed Jan 27, 2021
1 parent 2ac45ec commit 1e0c80f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class LuaTableFieldType : LuaStubElementType<LuaTableFieldStub, LuaTableField>("
override fun createStub(field: LuaTableField, parentStub: StubElement<*>): LuaTableFieldStub {
val className = findTableExprTypeName(field)
val indexTy = field.idExpr?.let {
SearchContext.withDumb(it.project, Ty.UNKNOWN) { context ->
SearchContext.withDumb(it.project, null) { context ->
it.guessType(context)
}
}
Expand All @@ -70,7 +70,7 @@ class LuaTableFieldType : LuaStubElementType<LuaTableFieldStub, LuaTableField>("
field.name,
flags,
valueTy)
} else if (indexTy != null) {
} else if (field.idExpr != null) {
valueTy = if (valueTy is TyMultipleResults) valueTy.list.first() else valueTy

return LuaTableFieldStubImpl(
Expand Down Expand Up @@ -146,7 +146,7 @@ class LuaTableFieldType : LuaStubElementType<LuaTableFieldStub, LuaTableField>("
LuaTableFieldStubImpl(stubElement,
this,
className,
indexType!!,
indexType,
isIndexExpression,
flags,
valueType)
Expand Down Expand Up @@ -232,7 +232,7 @@ class LuaTableFieldStubImpl : LuaStubBase<LuaTableField>, LuaTableFieldStub {
this.valueTy = valueTy
}

constructor(parent: StubElement<*>, elementType: LuaStubElementType<*, *>, className: String?, indexType: ITy, isIndexExpression: Boolean, flags: Int, valueTy: ITy?)
constructor(parent: StubElement<*>, elementType: LuaStubElementType<*, *>, className: String?, indexType: ITy?, isIndexExpression: Boolean, flags: Int, valueTy: ITy?)
: super(parent, elementType) {
this.className = className
this.name = null
Expand Down

0 comments on commit 1e0c80f

Please sign in to comment.