Open reitzig opened 3 years ago
Ah. The problem is the file name of the aggregate file, isn't it? kscript would either have to use the original file names, or rewrite the imports. :thinking:
It indeed assumed to the included file to be in the same package. It partially rewrites the imports to show up on top of the merged script.
Consider this file
repro.kts
:This runs and prints
Bar
-- all is well. Now, add an include directive (file can be empty):And we get an error:
Reproduces with and without content in
shared.kt
, and also with comment include directive. Also reproduces with other nested constructs such as inner classes:Does not reproduce with IDEA, which runs the files just fine (and created the import statement for me, in face). Therefore, I suspect a bug in kscript.
Real-life example: link
Version : v3.0.2 Kotlin : 1.4.21-release-351 Java : JRE 14.0.2+12)