diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/CommentBinders.kt b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/CommentBinders.kt index 7caa3e6862e..2138ceddb6a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/CommentBinders.kt +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/CommentBinders.kt @@ -58,14 +58,7 @@ object PrecedingDocCommentsBinder : WhitespacesAndCommentsBinder { if (tokens.isEmpty()) return 0 for (idx in tokens.indices.reversed()) { - val tokenType = tokens[idx] - when (tokenType) { - JetTokens.DOC_COMMENT -> return idx - - JetTokens.WHITE_SPACE -> continue - - else -> break - } + if (tokens[idx] == JetTokens.DOC_COMMENT) return idx } return tokens.size diff --git a/compiler/testData/psi/DocCommentsBinding.kt b/compiler/testData/psi/DocCommentsBinding.kt index c148f7366e2..e0cdaddfc3c 100644 --- a/compiler/testData/psi/DocCommentsBinding.kt +++ b/compiler/testData/psi/DocCommentsBinding.kt @@ -6,7 +6,7 @@ class A( /** * Doc comment for val-parameter */ - val p: Int + /*var*/val p: Int ) { /** * Doc comment for function diff --git a/compiler/testData/psi/DocCommentsBinding.txt b/compiler/testData/psi/DocCommentsBinding.txt index 19a1b2f7182..ae98d9eb4a9 100644 --- a/compiler/testData/psi/DocCommentsBinding.txt +++ b/compiler/testData/psi/DocCommentsBinding.txt @@ -27,6 +27,7 @@ JetFile: DocCommentsBinding.kt PsiWhiteSpace('\n ') PsiElement(KDOC_END)('*/') PsiWhiteSpace('\n ') + PsiComment(BLOCK_COMMENT)('/*var*/') PsiElement(val)('val') PsiWhiteSpace(' ') PsiElement(IDENTIFIER)('p')