title: Kotlin scripting support fails with "wrong number of arguments" whenever I try to run any script
body: <p>I'm trying to run a very basic script with <code>org.jetbrains.kotlin:kotlin-scripting-jvm</code>, but I get two errors, when I should get none. This is my script:</p>
  
  <pre><code>1
  </code></pre>
  
  <p>I expect to get back a <code>ResultWithDiagnostics.Success</code> with a <code>resultValue</code> of <code>1</code> but instead I get a <code>Failure</code>, with these reports:</p>
  
  <ul>
  <li>The expression is unused</li>
  <li>wrong number of arguments</li>
  </ul>
  
  <p>Even if I fix the warning by modifying my script to</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>class Foo(val foo: String = "foo")
  
  Foo()
  </code></pre>
  
  <p>I still get the <code>wrong number of arguments  error</code>. I checked the source and it seems that in </p>
  
  <pre class="lang-kotlin prettyprint-override"><code>BasicJvmScriptEvaluator:95
          return try {
              ctor.newInstance(*args.toArray()) &lt;-- here
          } finally {
              Thread.currentThread().contextClassLoader = saveClassLoader
          } 
  </code></pre>
  
  <p>args is empty. What am I doing wrong? This is how I try to run the script:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>private fun evalFile(scriptFile: File): ResultWithDiagnostics&lt;EvaluationResult&gt; {
      val compilationConfiguration = createJvmCompilationConfigurationFromTemplate&lt;TestScript&gt; {
          jvm {
              dependenciesFromCurrentContext(wholeClasspath = true)
          }
      }
  
      return BasicJvmScriptingHost().eval(scriptFile.toScriptSource(), compilationConfiguration, null)
  }
  </code></pre>
  
  <p>and this is the stack trace for this <code>wrong number of arguments</code> error I get:</p>
  
  <pre><code>java.lang.IllegalArgumentException: wrong number of arguments
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.evalWithConfigAndOtherScriptsResults(BasicJvmScriptEvaluator.kt:95)
      at kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke$suspendImpl(BasicJvmScriptEvaluator.kt:40)
      at kotlin.script.experimental.jvm.BasicJvmScriptEvaluator.invoke(BasicJvmScriptEvaluator.kt)
      at kotlin.script.experimental.host.BasicScriptingHost$eval$1.invokeSuspend(BasicScriptingHost.kt:47)
      at kotlin.script.experimental.host.BasicScriptingHost$eval$1.invoke(BasicScriptingHost.kt)
      at kotlin.script.experimental.host.BasicScriptingHost$runInCoroutineContext$1.invokeSuspend(BasicScriptingHost.kt:35)
      at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
      at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:238)
      at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.kt:116)
      at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:80)
      at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:54)
      at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
      at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:36)
      at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
      at kotlin.script.experimental.host.BasicScriptingHost.runInCoroutineContext(BasicScriptingHost.kt:35)
      at kotlin.script.experimental.host.BasicScriptingHost.eval(BasicScriptingHost.kt:45)
  </code></pre>