JET-39 Process ?. correctly in the receiver types

This commit is contained in:
Andrey Breslav
2011-05-23 10:42:50 +04:00
parent 9d123b5c4f
commit dd612c74e3
8 changed files with 104 additions and 66 deletions
@@ -0,0 +1,2 @@
fun Int?.optint() : Unit
val Int?.optval : Unit
+2
View File
@@ -73,3 +73,5 @@ fun foo() {
val IList<T>.lastIndex : Int
get() = this.size - 1
val Int?.opt : Int
+19 -1
View File
@@ -777,4 +777,22 @@ JetFile: Properties.jet
PsiElement(MINUS)('-')
PsiWhiteSpace(' ')
INTEGER_CONSTANT
PsiElement(INTEGER_LITERAL)('1')
PsiElement(INTEGER_LITERAL)('1')
PsiWhiteSpace('\n\n')
PROPERTY
PsiElement(val)('val')
PsiWhiteSpace(' ')
TYPE_REFERENCE
NULLABLE_TYPE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
PsiElement(SAFE_ACCESS)('?.')
PsiElement(IDENTIFIER)('opt')
PsiWhiteSpace(' ')
PsiElement(COLON)(':')
PsiWhiteSpace(' ')
TYPE_REFERENCE
USER_TYPE
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('Int')
+6 -2
View File
@@ -3,7 +3,7 @@ fun <~T~T, ~E~E> `T`T.foo(x : `E`E, y : `A`A) : `T`T {
y `+`plus 1
y `+1`+ 1.0
this?.`-`minus<T>(this)
this?.minus<T>(this)
this
}
@@ -11,6 +11,10 @@ fun <~T~T, ~E~E> `T`T.foo(x : `E`E, y : `A`A) : `T`T {
~A~class A
~+1~fun `A`A.plus(a : Any) {
1.`foo`foo()
true.`!`foo()
1
}
@@ -28,4 +32,4 @@ fun test() {
val <~TT~T> `TT`T.foo : `TT`T
fun Int.foo() = this`:std::Int`
~foo~fun Int.foo() = this`:std::Int`