Tests for return types
Transformation for Java boxed types Lexer fixed for hexadecimal doubles Longs detected from literals compareTo with self defined for numbers (working around an unsupported case)
This commit is contained in:
@@ -31,11 +31,13 @@ l3:
|
||||
jf(l4)
|
||||
r(false)
|
||||
l4:
|
||||
r(true && false)
|
||||
w(y)
|
||||
r(false)
|
||||
jf(l5)
|
||||
r(true)
|
||||
l5:
|
||||
r(false && true)
|
||||
w(z)
|
||||
l1:
|
||||
<END>
|
||||
|
||||
@@ -59,11 +59,13 @@ l0:
|
||||
jf(l4)
|
||||
r(true)
|
||||
l4:
|
||||
r(a && true)
|
||||
r(a)
|
||||
jt(l5)
|
||||
r(false)
|
||||
l1:
|
||||
l5:
|
||||
r(a || false)
|
||||
l1:
|
||||
<END>
|
||||
l2:
|
||||
<START>
|
||||
|
||||
@@ -54,10 +54,12 @@ l9:
|
||||
r(11)
|
||||
jmp(l11)
|
||||
l10:
|
||||
read (Unit)
|
||||
l11:
|
||||
r(12)
|
||||
r(a)
|
||||
jf(l12)
|
||||
read (Unit)
|
||||
jmp(l13)
|
||||
l12:
|
||||
r(13)
|
||||
|
||||
@@ -11,8 +11,9 @@ l6:
|
||||
r(1)
|
||||
ret(*)
|
||||
jmp(l9)
|
||||
l7:
|
||||
l8:
|
||||
read (Unit)
|
||||
l7:
|
||||
l9:
|
||||
<END>
|
||||
=====================
|
||||
@@ -62,6 +63,7 @@ l0:
|
||||
ret(*)
|
||||
jmp(l3)
|
||||
l2:
|
||||
read (Unit)
|
||||
l3:
|
||||
r(1)
|
||||
rf({a =>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
== blockAndAndMismatch ==
|
||||
fun blockAndAndMismatch() : Boolean {
|
||||
(return true) || (return false)
|
||||
}
|
||||
---------------------
|
||||
l0:
|
||||
<START>
|
||||
r(true)
|
||||
ret(*)
|
||||
jt(l2)
|
||||
r(false)
|
||||
ret(*)
|
||||
l2:
|
||||
r((return true) || (return false))
|
||||
l1:
|
||||
<END>
|
||||
=====================
|
||||
@@ -0,0 +1,3 @@
|
||||
fun blockAndAndMismatch() : Boolean {
|
||||
(return true) || (return false)
|
||||
}
|
||||
@@ -9,7 +9,7 @@ fun unitShort() : Unit = ()
|
||||
fun unitShortConv() : Unit = 1
|
||||
fun unitShortNull() : Unit = null
|
||||
|
||||
<error>fun intEmpty() : Int {}</error>
|
||||
fun intEmpty() : Int <error>{}</error>
|
||||
fun intShortInfer() = 1
|
||||
fun intShort() : Int = 1
|
||||
fun intBlockInfer() {1}
|
||||
@@ -18,3 +18,73 @@ fun intBlock() : Int {1}
|
||||
fun blockReturnUnitMismatch() : Int {<error>return</error>}
|
||||
fun blockReturnValueTypeMismatch() : Int {return <error>3.4</error>}
|
||||
fun blockReturnValueTypeMatch() : Int {return 1}
|
||||
fun blockReturnValueTypeMismatchUnit() : Int {return <error>()</error>}
|
||||
|
||||
fun blockAndAndMismatch() : Int {
|
||||
<error>true && false</error>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
return <error>true && false</error>
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
<error>(return <error>true</error>) && (return <error>false</error>)</error>
|
||||
}
|
||||
/*
|
||||
fun blockAndAndMismatch() : Int {
|
||||
true || false
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
return true || false
|
||||
}
|
||||
fun blockAndAndMismatch() : Int {
|
||||
(return true) || (return false)
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
return if (1 > 2) 1.0 else 2.0
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
return if (1 > 2) 1.0
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
return if (1 > 2) else 1.0
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
if (1 > 2)
|
||||
return 1.0
|
||||
else return 2.0
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
if (1 > 2)
|
||||
return 1.0
|
||||
return 2.0
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
if (1 > 2)
|
||||
else return 1.0
|
||||
return 2.0
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
if (1 > 2)
|
||||
1.0
|
||||
else 2.0
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
if (1 > 2)
|
||||
1.0
|
||||
else 2.0
|
||||
return 1
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
if (1 > 2)
|
||||
1.0
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
if (1 > 2)
|
||||
else 1.0;
|
||||
}
|
||||
fun blockReturnValueTypeMatch() : Int {
|
||||
if (1 > 2)
|
||||
1
|
||||
else 1.0
|
||||
}
|
||||
*/
|
||||
@@ -33,7 +33,8 @@ fun a(
|
||||
a : foo = 10,
|
||||
a : foo = 10,
|
||||
a : foo = 10,
|
||||
a : foo = 10
|
||||
a : foo = 10,
|
||||
a : foo = 0xffffffff.lng
|
||||
) {
|
||||
return 10
|
||||
return
|
||||
|
||||
@@ -678,6 +678,26 @@ JetFile: SimpleExpressions.jet
|
||||
PsiWhiteSpace(' ')
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('10')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace('\n ')
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('a')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
DOT_QUALIFIED_EXPRESSION
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('0xffffffff')
|
||||
PsiElement(DOT)('.')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('lng')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
|
||||
@@ -47,3 +47,7 @@ fun <T> t(t : T) : T {
|
||||
System.out.`java::java.io.PrintStream.print(Int)`print(1)
|
||||
System.out.`java::java.io.PrintStream.print(Double)`print(1.0)
|
||||
}
|
||||
|
||||
fun typeTransform() {
|
||||
Integer.getInteger("", 239)`:std::Int`
|
||||
}
|
||||
Reference in New Issue
Block a user