dukat icon indicating copy to clipboard operation
dukat copied to clipboard

StackOverflowError in ModelContext.unalias when running dukat on @pulumi/aws

Open lestephane opened this issue 4 years ago • 4 comments

I haven't see this StackOverflowError in other issues, so I'm entering it here.

When I try running dukat on pulumi:

dependencies {
   ...
   implementation(npm("@pulumi/aws", "^3.0.0", generateExternals = true))
   ...
}

kotlin {
    js(LEGACY) {
        nodejs {
            binaries.executable()
        }
    }
}

I'm getting the following:

> Task :generateExternalsIntegrated
Exception in thread "main" java.lang.StackOverflowError
	at kotlin.jvm.internal.Intrinsics.areEqual(Intrinsics.java:167)
	at org.jetbrains.dukat.astCommon.IdentifierEntity.equals(NameEntity.kt)
	at kotlin.jvm.internal.Intrinsics.areEqual(Intrinsics.java:167)
	at org.jetbrains.dukat.astCommon.QualifierEntity.equals(NameEntity.kt)
	at java.base/java.util.HashMap.getNode(HashMap.java:567)
	at java.base/java.util.LinkedHashMap.get(LinkedHashMap.java:440)
	at org.jetbrains.dukat.model.commonLowerings.ModelContext.unalias(ModelContext.kt:89)
	at org.jetbrains.dukat.model.commonLowerings.ModelContext.unalias(ModelContext.kt:90)

dukat in use is "version": "0.5.8-rc.3" according to the package.json in build/js/node_modules/dukat.

lestephane avatar Dec 28 '20 06:12 lestephane

I get this also when trying to import @google-cloud/pubsub's typings (index.d.ts).

Edit: Well, to be more specific:

Exception in thread "main" java.lang.StackOverflowError
        at kotlin.collections.CollectionsKt__IterablesKt.collectionSizeOrDefault(Iterables.kt:39)
        at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNodeNullable(convertTypeDeclarations.kt:110)
        at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNode(convertTypeDeclarations.kt:107)
        at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNode$default(convertTypeDeclarations.kt:106)
        at org.jetbrains.dukat.nodeIntroduction.ConvertTypeDeclarationsKt.convertToNodeNullable(convertTypeDeclarations.kt:92)

...etc... It just sort of loops around in there for several pages.

feywind avatar Jan 11 '21 21:01 feywind

Question to the maintainer: Is there a way I can find out which exact file is causing the problem? Do you need me to run the dukat command with some extra debug flags?

lestephane avatar Jan 12 '21 08:01 lestephane

Haven't had time to understand the bug but here's an example of a file (from react-compound-slider) that triggers the issue, and a version of the same file that works:

Broken:

import { SliderProps as _SliderProps, SliderState as _SliderState } from './types';
export { Slider } from './Slider';
export declare type SliderProps = _SliderProps;
export declare type SliderState = _SliderState;

Works:

export * from './types';
export { Slider } from './Slider';

xian avatar Mar 23 '21 01:03 xian