Don't write type arguments of types replaced with Any to metadata

Anonymous types are not approximated by frontend for private declarations.
Class IDs for such types are replaced by StringTable before being written
to metadata. JVM string table mangles such types and keeps them generic
for reflection. For other purposes the types are replaced with `Any`.
Type arguments of the replaced type should be ignored in the latter case.
Otherwise decompiled text builder crashes on an attempt to restore `Any`
type with non-zero number of type arguments.

The code pretending to replace a type with its first supertype was dropped
from ApproximatingStringTable for two reasons:
- the first type from `getAllSuperClassifiers` is the original type itself
which doens't provide a ClassId for anonymous type, so it was a noop
- tracking potential type arguments of the first anonymous type's supertype
would be a complication with almost no practical value (types in decompiled
text would be slightly closer to the real type of a private declaration).

^KT-46393 Fixed
This commit is contained in:
Pavel Kirpichenkov
2021-05-18 12:02:56 +03:00
committed by Space
parent fefc6f9b53
commit f5a53c82c5
6 changed files with 24 additions and 9 deletions
@@ -1,2 +0,0 @@
// TODO: See KT-13618
// IGNORE_BACKEND: JS