Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d593185

Browse files
smowtonigfoo
authored andcommitted
Quieten errors relating to generic type aliases
Turns out type aliases are always substituted by the compiler, with the `IrSimpleType.abbreviation` field indicating what the original alias was if any. Therefore we're already extracting the right types. This commit simply omits extracting a kt_type for a type alias that uses type parameters as this certainly won't work at present because we don't have IrTypes for the type parameters declared by the alias and used in its RHS.
1 parent 1d47ea3 commit d593185

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,8 @@ open class KotlinFileExtractor(
724724
with("type alias", ta) {
725725
if (ta.typeParameters.isNotEmpty()) {
726726
// TODO: Extract this information
727-
logger.error("Type alias type parameters ignored for " + ta.render())
727+
logger.error("Type alias with type parameters discarded: " + ta.render())
728+
return
728729
}
729730
val id = useTypeAlias(ta)
730731
val locId = tw.getLocation(ta)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Test<T> {}
2+
3+
typealias Alias2<R> = Test<R>
4+
5+
typealias Alias1<S> = Alias2<S>
6+
7+
fun f() : Alias1<String> = Test<String>()

0 commit comments

Comments
 (0)