https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
scripting
  • l

    lburgazzoli

    07/14/2020, 5:18 PM
    some time ago I've wrote to the kotlin forum about that setting jvmtarget=11 breaks kotlin dsl used in scripting, the full discussion is here: https://discuss.kotlinlang.org/t/setting-jvmtarget-to-11-breaks-dsl. Posting here to see if there is any one that know how to fix that
    i
    • 2
    • 2
  • a

    asad.awadia

    07/15/2020, 8:30 PM
    kscript only works for java 8?
    a
    • 2
    • 1
  • h

    H.An

    07/20/2020, 7:41 AM
    Hi, I’m new to scripting, I need to evaluate a script every time the application gets a http request and it increases metaspace and loaded classes. Does anybody know how to keep it under ** size?
    n
    d
    • 3
    • 4
  • s

    Sergio Pro

    07/29/2020, 1:16 PM
    Hi! How do I import another script file?
    @Import
    annotation does not seem to be working for me: `common.main.kts`:
    #!/usr/bin/env -S kotlinc -script --
    
    val greeting = "Hello"
    `sample.main.kts`:
    #!/usr/bin/env -S kotlinc -script --
    
    @file:org.jetbrains.kotlin.script.util.Import("common.main.kts")
    
    print(greeting) // unresolved reference and nothing to import
    Both files are in the same directory and I've tried relative and absolute paths. Am I doing something wrong here? I know it's possible with
    kscript
    but I would prefer to keep extra dependencies to a minimum. Doesn't kotlin have built-in support for this and I'm totally misunderstanding what
    @Import
    annotation is supposed to do?
    i
    • 2
    • 3
  • s

    SrSouza

    08/17/2020, 6:37 PM
    Hi folks, I want to ask a feature for Kotlin Main Kts to work with external libraries, could be possible to have a config file ta provides all implicit imports for the MainKts in a library. Use case: I'm building library that adds DSL for easy use of Git API, I could just create this file under
    META-INF/kotlin/script/import.list
    with all the implicit imports provided to the script that uses my library as a dependency (with the
    @file:DependOn()
    )
    i
    • 2
    • 2
  • s

    SrSouza

    08/18/2020, 12:14 AM
    Hi folks, I update to Kotlin 1.4.0 and my script stop work on IntelliJ. This is the exception that I'm getting in my IntelliJ plugin:
    i
    • 2
    • 6
  • l

    laht

    08/18/2020, 11:15 AM
    I'm struggeling with kotlin-main-kts that does not resolve transitative implementation and runtimeOnly dependencies. I would rather not set all my library dependencies to api. Should it be like that?
    i
    • 2
    • 2
  • s

    SrSouza

    08/18/2020, 1:23 PM
    Hi @ilya.chernikov, there is anyway to set the Maven Cache folder for the 
    MavenDependenciesResolver
     (by using 
    scripting-dependencies-maven
    )? I could find a way with the Ivy (my implementation: https://github.com/DevSrSouza/Bukkript/blob/master/script-definition/src/main/kotlin/br/com/devsrsouza/bukkript/script/definition/dependencies/IvyResolver.kt#L85)
    i
    • 2
    • 1
  • s

    Steve Roach

    08/18/2020, 2:12 PM
    Moving from kotlin 1.3.72 to 1.4.0 broke my simple app. Currently the app parses a dsl string and casts it to a class. Works fine in 1.3.72. I am currently using Kotlin-script-util, kotlin-compiler-embeddable, kotlin-compiler-embeddable. I am now getting Error class not found org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineFactoryBase. Any idea what maven dependencies I am missing/should change to?
    i
    • 2
    • 5
  • j

    Jakub Gwóźdź

    08/18/2020, 3:26 PM
    Hi. Just started playing with kotlin scripting, got my first script up and running (jdk 11) simply by calling rwxr--r-- file ./dbtest.main.kts, that starts with shebang like
    #!/usr/bin/env kotlinc -Xadd-modules=java.sql -script
    @file:DependsOn("mysql:mysql-connector-java:8.0.19")
    
    import java.sql.DriverManager
    
    ... actual code
    now the problem is, that I cannot use
    AutoCloseable.use { .... }
    extension function, because it's not in common/jvm stdlib. How can I force kotlinc to use -jdk8 stdlib?
    i
    • 2
    • 4
  • l

    Lukas Morawietz

    08/18/2020, 4:57 PM
    Hi folks, the kotlin scripting keep mentions script-based dsl (https://github.com/Kotlin/KEEP/blob/master/proposals/scripting-support.md#script-based-dsl). Is this possible in the current version? If so, is there a sample project?
    i
    e
    • 3
    • 9
  • s

    SrSouza

    08/19/2020, 12:44 PM
    Hi folks, what is the stage of Compiler Plugins at the script? I want to be able to use Kotlinx.serialization.
    i
    e
    • 3
    • 5
  • j

    jw

    08/21/2020, 3:15 PM
    can i somehow AOT-compile my script into a jar or set of jars to run somewhere without kotlin available? would also be nice to be able to produce something that I can feed into graal native-image. Passing
    -d out
    has no effect, and obviously I cannot compile without
    -script
    .
    k
    a
    i
    • 4
    • 10
  • s

    SrSouza

    08/24/2020, 12:08 PM
    Hi folks, I'm
    java.lang.NoClassDefFoundError: com/intellij/openapi/util/Disposer
    when running my Script Compiler. The dependency that I'm using is
    kotlin-scripting-jvm-host
    , I check it at the final jar and the
    com/intellij
    actually missing, any idea here?
    i
    e
    • 3
    • 4
  • v

    Vampire

    08/25/2020, 5:15 PM
    I tried to use 1.3.72 JSR223 artifact from a Gradle script (don't ask why, needed blaaaaack magic if it works as I imagine) Unfortunately I didn't yet get it working. I added
    buildscript {
        dependencies {
            classpath(kotlin("scripting-jsr223", "1.3.72"))
        }
    }
    And then I tried to do
    println("kt: " + javax.script.ScriptEngineManager().getEngineByExtension("kt"))
    but it does not work. The output is
    ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider kotlin.script.experimental.jsr223.KotlinJsr223DefaultScriptEngineFactory could not be instantiated
    kt: null
    If I use the debugger, I can extract this stacktrace:
    java.util.ServiceConfigurationError: javax.script.ScriptEngineFactory: Provider kotlin.script.experimental.jsr223.KotlinJsr223DefaultScriptEngineFactory could not be instantiated
    	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:581)
    	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:803)
    	at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:721)
    	at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1394)
    	at java.scripting/javax.script.ScriptEngineManager.initEngines(ScriptEngineManager.java:125)
    	at java.scripting/javax.script.ScriptEngineManager.init(ScriptEngineManager.java:87)
    	at java.scripting/javax.script.ScriptEngineManager.<init>(ScriptEngineManager.java:62)
    	at Build_gradle.<init>(build.gradle.kts:118)
        [...]
    	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    	at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.IllegalArgumentException: Unable to construct script definition: Unable to load base class kotlin.script.experimental.api.KotlinType@428395ed
    	at kotlin.script.experimental.host.ConfigurationFromTemplateKt.getTemplateClass(configurationFromTemplate.kt:101)
    	at kotlin.script.experimental.host.ConfigurationFromTemplateKt.createCompilationConfigurationFromTemplate(configurationFromTemplate.kt:37)
    	at kotlin.script.experimental.jsr223.KotlinJsr223DefaultScriptEngineFactory.<init>(KotlinJsr223DefaultScriptEngineFactory.kt:74)
    	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:779)
    	... 168 more
    Caused by: java.lang.IllegalArgumentException: unable to load class kotlin.script.experimental.jsr223.KotlinJsr223DefaultScript
    	at kotlin.script.experimental.jvm.JvmGetScriptingClass.invoke(jvmScriptingHostConfiguration.kt:111)
    	at kotlin.script.experimental.jvm.JvmGetScriptingClass.invoke(jvmScriptingHostConfiguration.kt:64)
    	at kotlin.script.experimental.host.ConfigurationFromTemplateKt.getTemplateClass(configurationFromTemplate.kt:99)
    	... 175 more
    Caused by: java.lang.ClassNotFoundException: kotlin.script.experimental.jsr223.KotlinJsr223DefaultScript
    	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    	at kotlin.script.experimental.jvm.JvmGetScriptingClass.invoke(jvmScriptingHostConfiguration.kt:109)
    	... 177 more
    Anyone have any idea? Or is there maybe onther way to use Kotlin scripting? Actually what I need is, I have a Kotlin file with an object expression and I need that object expression as reference. But as it is in
    buildSrc/build.gradle.kts
    I have no compile task where I could throw this in and it is 1. too long to just paste it into the build script and I 2. need it in a later phase too and wanted to avoid copy&paste
    i
    n
    n
    • 4
    • 61
  • a

    altavir

    08/30/2020, 11:34 AM
    I've just migrated some of my libraries to 1.4 and I am using IR for JVM. I am getting
    ERROR Class 'hep.dataforge.workspace.WorkspaceBuilder' is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler (script.kts:3:1)
    java.lang.IllegalStateException: ERROR Class 'hep.dataforge.workspace.WorkspaceBuilder' is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler (script.kts:3:1)
    when interpreting a script from string. Why is that?
    u
    • 2
    • 3
  • s

    SrSouza

    09/01/2020, 4:07 PM
    Hi folks, how I retrieve the sources from the
    MavenDependenciesResolver
    to insert it on
    ide.dependenciesSources
    ?
    • 1
    • 1
  • i

    irus

    09/02/2020, 7:03 PM
    New JVM host doesn’t work inside tests in maven (3.6.3) + JDK 1.8:
    Cannot access script base class 'io.bootique.kotlin.config.ScriptingBQConfigurationScript'. Check your module classpath for missing or conflicting dependencies
    Unresolved reference: addConfig
    	at io.bootique.kotlin.config.KotlinScriptCompilerTest.execute simple script config file(KotlinScriptCompilerTest.kt:36)
    https://travis-ci.org/github/bootique/bootique-kotlin/jobs/723554789#L863 On JDK 11+ looks good: https://travis-ci.org/github/bootique/bootique-kotlin/builds/723554788
    i
    • 2
    • 8
  • n

    Nikky

    09/05/2020, 9:50 AM
    when i do
    defaultImports.append("voodoo.dsl.*")
    that show allow the script to use all extension functions declared in that package correct ? i am facing some weird issues while trying to work on the DSL accessible from the scripts errors like
    'fun <E : NestedEntry> NestedEntry.Curse.list(initList: ListBuilder<NestedEntry.Curse>.() -> Unit): NestedEntry.Curse' can't be called in this context by implicit receiver. Use the explicit one if necessary
    function looks like
    fun <E: NestedEntry> E.list(
        initList: ListBuilder<E>.() -> Unit
    ): E {
        val listBuilder = ListBuilder(this)
        listBuilder.initList()
        // add all entries from list
        entries += listBuilder.listEntries
        return this
    }
    and i am not sure why it cannot be called on a receiver.. maybe the DSL markers mess it up.. but i call it directly on the object and it also compiles in other parts of the code that are not compiled by script
    i
    • 2
    • 1
  • d

    darkmoon_uk

    09/08/2020, 4:37 AM
    Around 18 months ago I tried as hard as I could to get Kotlin Scripts (inc. the embedded compiler component) to run on Android. I was met with insurmountable difficulties; as I recall the bytecode level of the redistributables itself couldn't even run on Android/ART(?) Has this changed, has anyone run Kotlin Scripts on Android ❓
    m
    i
    • 3
    • 2
  • e

    Egor

    09/10/2020, 9:49 AM
    @ilya.chernikov I upgraded to 1.4.10 and the issue is resolved.
    👍 2
    i
    • 2
    • 2
  • c

    Czar

    09/22/2020, 12:03 PM
    Hi, I'm trying to update my project that uses scripting to kotlin 1.4.10, but kotlin-scripting-jsr223-embeddable cannot be found in the repos:
    Could not find org.jetbrains.kotlin:kotlin-scripting-jsr223-embeddable:1.4.10.
    Required by:
        project :asdf:qwer
    Is it just delayed so much behind Kotlin main, or should I switch to something else for embedded scripting? I tried using 1.3.72 for scripting and 1.4.10 for the main application, but that doesn't work:
    java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.cli.common.repl.GenericReplCompilingEvaluatorBase.<init>(org.jetbrains.kotlin.cli.common.repl.ReplCompiler, org.jetbrains.kotlin.cli.common.repl.ReplEvaluator, org.jetbrains.kotlin.cli.common.repl.ScriptArgsWithTypes, int, kotlin.jvm.internal.DefaultConstructorMarker)'
    v
    • 2
    • 2
  • a

    arocnies

    09/24/2020, 5:07 AM
    Does anyone know how to give loaded scripts a package? I suspect I have something misconfigured
    i
    • 2
    • 2
  • v

    vylet

    09/28/2020, 6:32 PM
    is there a way to exclude transitive dependency in kotlin main.kts script file, something like below
    @file:DependsOn("org.slf4j:slf4j-simple:1.7.30", exclude = "org.slf4j:slf4j-api")
    i
    • 2
    • 5
  • a

    arocnies

    09/28/2020, 10:51 PM
    I've created an
    @Import
    annotation that works the same way as simple version of
    main-kts
    . Everything works fine when importing another script's function but I'm unable to import a class defined in the other script. It seems reasonable that classes defined in the script class's scope so I suspect I need my compilation configuration to do something to include them. Anyone know where I should be looking?
    i
    • 2
    • 7
  • s

    SrSouza

    10/05/2020, 10:28 PM
    Hey @ilya.chernikov, about the Roadmap,
    scripting improvements
    is
    postponed for later
    , this means that you folks will stop improving it?
    i
    • 2
    • 1
  • l

    Luis Munoz

    10/06/2020, 3:41 PM
    If I eval a class ObA{} create and instance and return it then I eval another class ObjB{} create and instance and return in. Do I have to do any clean up? From what I understand between each eval there is access to previous classes that were declared. I don't want access to ObjA declation but I will still use the returned instance. How do I clean up?
    i
    • 2
    • 6
  • h

    holgerbrandl

    10/07/2020, 8:43 PM
    Hi there, how can I add jcenter to CompoundDependenciesResolver? I guess via resolver.addRepository() but I can't figure out how to so do and could not yet find any example.
    i
    • 2
    • 1
  • l

    laht

    10/09/2020, 7:45 AM
    When I try to run a script in the context of main.kts using IntelliJ context I get a headless exception when trying to initialize a OpenGL context. This does not happen when I run the same code through a ScriptEngineManager context. What gives?
    • 1
    • 2
  • m

    Matthieu Stombellini

    10/10/2020, 6:35 PM
    Hi, is it possible to use sealed classes declared in another script file ? This doesn't seem to work test.main.kts
    sealed class Test {
        object One : Test()
        object Two : Test()
    }
    test2.main.kts
    @file:Import("test.main.kts")
    
    println("I have one: " + Test.One)
    println("I have two: " + Test.One)
    Error:
    $ kotlin
    Welcome to Kotlin version 1.4.0 (JRE 14.0.1+7)
    ...
    $ kotlin test2.main.kts
    error: unresolved reference: Test (test2.main.kts:3:26)
    error: unresolved reference: Test (test2.main.kts:4:26)
    test2.main.kts:3:26: error: unresolved reference: Test
    println("I have one: " + Test.One)
                             ^
    test2.main.kts:4:26: error: unresolved reference: Test
    println("I have two: " + Test.One)
                             ^
    Is that supposed to happen? What am I missing here ?
    v
    • 2
    • 2
Powered by Linen
Title
m

Matthieu Stombellini

10/10/2020, 6:35 PM
Hi, is it possible to use sealed classes declared in another script file ? This doesn't seem to work test.main.kts
sealed class Test {
    object One : Test()
    object Two : Test()
}
test2.main.kts
@file:Import("test.main.kts")

println("I have one: " + Test.One)
println("I have two: " + Test.One)
Error:
$ kotlin
Welcome to Kotlin version 1.4.0 (JRE 14.0.1+7)
...
$ kotlin test2.main.kts
error: unresolved reference: Test (test2.main.kts:3:26)
error: unresolved reference: Test (test2.main.kts:4:26)
test2.main.kts:3:26: error: unresolved reference: Test
println("I have one: " + Test.One)
                         ^
test2.main.kts:4:26: error: unresolved reference: Test
println("I have two: " + Test.One)
                         ^
Is that supposed to happen? What am I missing here ?
v

Vampire

10/10/2020, 9:14 PM
According to https://youtrack.jetbrains.com/issue/KT-34178 this is fixed for 1.4.20 and before you would need to use
Test_main.Test.One
m

Matthieu Stombellini

10/11/2020, 6:04 PM
Oh, that's great news! I didn't realize this was such a general bug, I thought it was specific to sealed classes. Thanks!
View count: 11