https://kotlinlang.org logo
Title
b

breandan

02/14/2023, 3:01 AM
Can anyone think of a reason why
./gradlew browserDevelopmentRun
would throw the following error in Chrome and Safari but otherwise work in Firefox?
Uncaught TypeError: _this__u8e3s4.get_first_irdx8n_k$ is not a function
    at get_LHS (CFG.kt?0f81:15:32)
    at getParametersIn (CFG.kt?0f81:120:32)
    at eliminateParametricityFromLHS (CFG.kt?0f81:136:31)
    at normalize (Standard.kt?4256:138:43)
    at normalForm$delegate$lambda (CFG.kt?0f81:32:36)
    at eval (Graph.kt?c30b:185:29)
    at protoOf.getOrPut_x8bkas_k$ (Standard.kt?4256:13:31)
    at sam$kotlin_properties_ReadOnlyProperty$0.eval [as function_1] (Graph.kt?c30b:185:11)
    at protoOf.getValue_4lco8v_k$ (galoisenne.js:14950:17)
    at get_normalForm (CFG.kt?0f81:32:28)
Here is the relevant context for the Kotlin code in question:
typealias Π2<A, B> = Pair<A, B>
typealias Σᐩ = String
typealias Production = Π2<Σᐩ, List<Σᐩ>>
typealias CFG = Set<Production>

val Production.LHS: Σᐩ get() = first
c

Chris Lee

02/14/2023, 3:53 AM
there’s a lot of special symbols there - perhaps they aren’t making the trip to JS very well.
b

breandan

02/14/2023, 4:22 AM
I thought that too, but the error still occurs after renaming to ASCII. And only on Chrome / Safari...
c

Chris Lee

02/14/2023, 5:25 AM
interesting. does
_this__u8e3s4.get_first_irdx8n_k$
exist and look like a function?
b

breandan

02/14/2023, 5:28 AM
I was looking but didn't see it defined anywhere in the generated JS
All of the usages seem to be callers
c

Chris Lee

02/14/2023, 5:30 AM
hmmm. perhaps the name mangling is problematic - does the containing object exist (outside of callers into it)?
_this__u8e3s4
a

andylamax

02/14/2023, 5:35 AM
kotlin version??
b

breandan

02/14/2023, 5:36 AM
It seems to just be a variable name for the extension receiver. I'm using
1.8.20-Beta
Also seems to appear quite frequently inside the JS-compiled Kotlin stdlib, but no declaration.
c

Chris Lee

02/14/2023, 5:41 AM
is it possible the JS files are included out-of-order in the browser?
b

breandan

02/14/2023, 5:52 AM
Well there's only a single script file so I'm not sure how that could happen. FF loads and runs without an error, Safari fails
a

andylamax

02/14/2023, 5:53 AM
With kotlin/js, i reaised sometimes just running a clean build can work. Did you try that?? running a clean build?
b

breandan

02/14/2023, 5:55 AM
Yes, I tried cleaning the project and restarting via
./gradlew clean kotlinUpgradeYarnLock browserDevelopmentRun --continuous
, same error
c

Chris Lee

02/14/2023, 5:55 AM
looks like Safari is loading the JS file from cache - perhaps try clearing out / disabling the browser cache.
b

breandan

02/14/2023, 5:59 AM
Same issue with the cache cleared & disabled
Maybe I'll just submit a ticket
Thanks for your suggestions
c

Chris Lee

02/14/2023, 6:01 AM
yea could be the beta Kotlin.