Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'recursive value needs type' when using string interpolation linter and "suspicious" definition #10125

Closed
scabug opened this issue Dec 29, 2016 · 3 comments · Fixed by scala/scala#10567
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Dec 29, 2016

Here is code that compiles fine without linter and fails when linter is enabled:

object Foo {
  implicit class HasIr(s: String) {
    def ir: Int = 1234
  }

  val bar = "$bar".ir
}

When adding scalacOptions += "-Xlint", the compilation fails as follows:

[error] /home/hhrutz/Documents/temp/interp_bug/src/main/scala/foo/Foo.scala:8: recursive value bar needs type
[error]   val bar = "$bar".ir
[error]             ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed

Obviously the linter doesn't get to warn me about possible missing string interpolation (the dollar is intended in my case and not an interpolator), but then gets stuck assuming that $bar is interpolated bar.

@scabug
Copy link
Author

scabug commented Dec 29, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10125?orig=1
Reporter: @Sciss
Affected Versions: 2.12.1

@scabug
Copy link
Author

scabug commented Jan 10, 2017

@SethTisue said:
@som-snytt this one might interest you?

@som-snytt
Copy link

som-snytt commented Oct 16, 2023

@Value("${myProperty}")
var myProperty: String = _

also nobody said linterpolator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants