svtk / AtomicKotlinCourse

87 stars 21 forks source link

Variable Argument Lists exercise 1 inherently won't compile or pass #74

Open danascheider opened 1 year ago

danascheider commented 1 year ago

Hi folks! I'm working through the exercises and realised exercise 1 in the Variable Argument Lists atom seems to have no way to pass in IntelliJ IDEA. I need to capture the output of an error and print it to the console. However, the error to be captured is a compile-time error, not a runtime error, so the program can't even run to print its message. If I don't implement anything, then the tests fail. Am I missing something, or is there just no way to make this exercise pass?

I tried all of these solutions and none worked:

Function declared outside main (wouldn't compile)

// Varargs1/Task.kt
package variableArgumentListsExercise1

import atomictest.capture

fun multipleVarargs(vararg a: Int, vararg b: Double) {}

fun main() {
  println(capture { multipleVarargs(1, 2, 1.0, 2.0) })
}

Function declared inside main (wouldn't compile)

// Varargs1/Task.kt
package variableArgumentListsExercise1

import atomictest.capture

fun main() {
  println(
    capture {
      fun multipleVarargs(vararg a: Int, vararg b: Int) {}
    }
  )
}

Nothing implemented (tests failed)

// Varargs1/Task.kt
package variableArgumentListsExercise1

// TODO

fun main() {
  // TODO
}

Thanks for your time & help!