Skip to content

Conversation

@som-snytt
Copy link
Contributor

@scala-jenkins scala-jenkins added this to the 2.13.14 milestone Mar 4, 2024
@som-snytt
Copy link
Contributor Author

The failure confused me because at midnight I enabled linting and thought I got rid of that "arg parser" on that PR. Actually, the error started on this PR, not because I enabled linting but because I fixed the "recursive implicit" lint (accidentally or incidentally).

Anyway, I wound up ripping out the old "CLI spec" experiment from partest, where it had been sequestered. LOC are just a maintenance cost if they don't pull their weight.

@som-snytt som-snytt changed the title Improve symbol in implicit result check Improve symbol in implicit result check [ci: last-only] Mar 5, 2024
*/
implicit val IntFromString: FromString[Int] = new FromString[Int] {
override def isDefinedAt(s: String) = s.toIntOption.isDefined
def apply(s: String) = s.toInt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def apply(s: String) = s.toInt
def apply(s: String) = Integer.parseInt(s)

Agree about LOC weight and such, but the lint is right - why not fix the code? It's a great example where the lint actually helps

scala> implicit val s2i: String => Int = x => x.toInt
                                              ^
       warning: Implicit resolves to enclosing value s2i
val s2i: String => Int = $Lambda/0x0000000800644a40@446e7065

scala> "3": Int

       val $line3$read: $line3.$read.INSTANCE.type = $line3.$read.INSTANCE; import $line3$read.$iw.`s2i`
                                                                                                   ^
<synthetic>:2: warning: Unused import

(To diagnose errors in synthetic code, try adding `// show` to the end of your input.)
java.lang.StackOverflowError
  at $anonfun$s2i$1(<console>:1)
  at $anonfun$s2i$1$adapted(<console>:1)

Copy link
Contributor Author

@som-snytt som-snytt Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK here I'll restore it to its previous correct version, then rip it out in the other PR.

partest does no arg converting, is why it didn't matter.

edit: I didn't quite revert the LOC.

@som-snytt som-snytt marked this pull request as ready for review March 5, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unusual error message package object implicits

3 participants