From 3e548c2612f547f21c35ba61420b0b33624ef2b3 Mon Sep 17 00:00:00 2001 From: taku0 Date: Sun, 15 Jan 2023 13:37:44 +0900 Subject: [PATCH] Support definitely non-nullable type --- kotlin-mode-lexer.el | 8 ++++---- test/pathological.kt | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/kotlin-mode-lexer.el b/kotlin-mode-lexer.el index 0402325..8e99415 100644 --- a/kotlin-mode-lexer.el +++ b/kotlin-mode-lexer.el @@ -683,7 +683,7 @@ expression as a token with one of the following types: '(implicit-\; string-chunk-before-template-expression)) (member (kotlin-mode--token-text previous-token) - '("(" "{" "[" "*" "%" "/" "+" "-" "&&" "||" ":" + '("(" "{" "[" "*" "%" "/" "+" "-" "&&" "||" ":" "&" "=" "+=" "-=" "*=" "/=" "%=" "->" "." ".." "::" "?:" "?." "<=" ">=" "!=" "!==" "==" "===" "as" "as?" "is" "!is" "in" "!in" "," ";" "{" "[" "(" @@ -790,7 +790,7 @@ expression as a token with one of the following types: '(implicit-\; string-chunk-after-template-expression)) (member (kotlin-mode--token-text next-token) - '("*" "%" "/" "&&" "||" ":" "=" "+=" "-=" "*=" "/=" "%=" + '("*" "%" "/" "&" "&&" "||" ":" "=" "+=" "-=" "*=" "/=" "%=" "->" "." ".." "::" "?:" "?." "?" "<" ">" "<=" ">=" "!=" "!==" "==" "===" "," ";" ")" "]" "}" @@ -1828,7 +1828,7 @@ This function does not return `implicit-;'." "=" "+=" "-=" "*=" "/=" "%=" "->" ".." "." "?:" "?." "?" "<" ">" "<=" ">=" "==" "===" - "*" "%" "/" "+" "-"))) + "*" "%" "/" "+" "-" "&"))) (let ((text (match-string-no-properties 0)) (start (match-beginning 0)) (end (match-end 0))) @@ -2233,7 +2233,7 @@ This function does not return `implicit-;'" ((member (buffer-substring-no-properties (max (point-min) (- (point) 1)) (point)) - '("*" "%" "/" "+" "-" "!" "=" "." "?" "<" ">")) + '("*" "%" "/" "+" "-" "!" "=" "." "?" "<" ">" "&")) (backward-char) (make-instance 'kotlin-mode--token :type 'operator diff --git a/test/pathological.kt b/test/pathological.kt index c12342f..b17d82a 100644 --- a/test/pathological.kt +++ b/test/pathological.kt @@ -426,6 +426,15 @@ public -> C + // definitelyNonNullableType + fun foo( + x: + A + & + Any + ) { + } + // value class value