Skip to content

Commit

Permalink
Fixed generic alias equality.
Browse files Browse the repository at this point in the history
Closes #85
  • Loading branch information
Benjamin-Dobell committed Jul 24, 2021
1 parent e953eba commit 6a84154
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/tang/intellij/lua/ty/TyGeneric.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ open class TyGeneric(override val args: Array<out ITy>, override val base: ITy)
return true
}

val resolved = Ty.resolve(this, context)

if (resolved !== this) {
return resolved.equals(other, context)
}

val resolvedOther = Ty.resolve(other, context)

if (resolvedOther is ITyGeneric && args.size == resolvedOther.args.size && base.equals(resolvedOther.base, context)) {
Expand Down
14 changes: 14 additions & 0 deletions src/test/kotlin/com/tang/intellij/test/issues/Issues.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,18 @@ class Issues : LuaInspectionsTestBase(
""".trimIndent()
)
}

// https://github.com/Benjamin-Dobell/IntelliJ-Luanalysis/issues/85
fun test85() {
check(
"""
---@alias set<x> table<x,any>
---@type set<set<number>>
local aSet
aSet = aSet
""".trimIndent()
)
}
}

0 comments on commit 6a84154

Please sign in to comment.