fwcd / fwcd/kotlin-language-server

"This variable must either have a type annotation or be initialized" when first calling constructor and then prepending the variable initialization

Open
#59 0 comments 0 reactions 0 assignees View on GitHub
bug diagnostics
Dominant language
Kotlin
Stars
2k
Forks
252
PR merge metrics
No merged PRs in 30d

Description

Reproduce:
1. First call the constructor eg:
```kotlin
BufferedReader(reader)
```
2. Prepend that line with the variable declaration/initialization
```kotlin
val buf = BufferedReader(reader)
```
3. Errors with above message

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the two-step Kotlin example in the language server and capture the diagnostic after prepending the declaration. Trace the handling of constructor calls and variable declarations to identify where the erroneous type-annotation message is produced, then add a regression test showing that the initialized declaration is accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.