[IR] Fix compiler bugs with MFVC to let KorGE run
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com> #KT-1179
This commit is contained in:
committed by
Space Team
parent
9b3fc34f78
commit
3b5ad0681f
@@ -6,6 +6,14 @@
|
||||
@JvmInline
|
||||
value class DPoint(/*inline */val x: Double/* = 1.0*/, /*inline */val y: Double/* = 2.0*/) {
|
||||
fun f1(a: Int, b: Int = -1, c: DPoint = DPoint(-2.0, -3.0)) = listOf(this, x, y, a, b, c)
|
||||
|
||||
companion object {
|
||||
inline operator fun invoke(): DPoint = DPoint(0.0, 0.0)
|
||||
}
|
||||
}
|
||||
|
||||
object RegularObject {
|
||||
fun pointToString(x: DPoint? = DPoint()) = "$x"
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
@@ -21,6 +29,14 @@ fun complexFun(a1: Double, a2: DPoint, a3: Double = a1 * a2.x * a2.y, a4: DPoint
|
||||
|
||||
inline fun complexInlineFun(a1: Double, a2: DPoint, a3: Double = a1 * a2.x * a2.y, a4: DPoint = DPoint(a2.x * a1 * a3, a2.y * a1 * a3)) = "$a1, $a2, $a3, $a4"
|
||||
|
||||
fun getLineIntersectionPoint(out: DPoint = DPoint()): DPoint? {
|
||||
return getIntersectXY(out)
|
||||
}
|
||||
|
||||
fun getIntersectXY(out: DPoint = DPoint()): DPoint? {
|
||||
return out
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
// comments bellow are because MFVC primary constructors default parameters require support of inline arguments in regular functions
|
||||
// require(DPoint() == DPoint(1.0, 2.0)) { "${DPoint()} ${DPoint(1.0, 2.0)}" }
|
||||
@@ -86,5 +102,8 @@ fun box(): String {
|
||||
complexInlineFun(2.0, DPoint(3.0, 5.0), 7.0, DPoint(11.0, 13.0))
|
||||
}
|
||||
|
||||
require(RegularObject.pointToString() == "DPoint(x=0.0, y=0.0)") { RegularObject.pointToString() }
|
||||
require(getLineIntersectionPoint().toString() == "DPoint(x=0.0, y=0.0)") { getLineIntersectionPoint().toString() }
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user