jtonic
12/07/2017, 6:05 AMError:(13, 30) Kotlin: Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly
in the following case
package ro.jtonic.tutorials.kt.oop.miscs
private const val PI = Math.PI
const val E = Math.E
private fun computePi() = PI
fun computeE() = E
class MyMath {
val E = FilePrivateUtils@::E.get() // here is the compilation error
val pi = FilePrivateUtils@::PI.get()
fun computingPi() = FilePrivateUtils@::computePi.invoke()
fun computingE() = FilePrivateUtils@::computeE.invoke()
}
Thank you.val E: Double = FilePrivateUtils@::E.get()
then the value is 0 instead of value of e.
the only thing to do (for me) is to rename the field as e.
But I don’t like to have this especially for the class functions.adam-mcneilly
12/07/2017, 6:11 AME
that you're assigning, and not the E
that's in your private utils.
Also, for my own curiosity, why are you assigning Math.e
to a val, and then having a function that returns it? Why not just reference Math.E
inside MyMath
whenever you need it?jtonic
12/07/2017, 6:15 AMilya.gorbunov
12/07/2017, 11:29 AMFilePrivateUtils