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

any matcher fails to resolve "nested" value classes in 1.7.0 #171

Closed
mikolak-net opened this issue Oct 30, 2019 · 1 comment
Closed

any matcher fails to resolve "nested" value classes in 1.7.0 #171

mikolak-net opened this issue Oct 30, 2019 · 1 comment

Comments

@mikolak-net
Copy link

mikolak-net commented Oct 30, 2019

Sorry for being the bearer of bad news, but there appears to be a regression in 1.7.0 . The any matcher (or its underlying macro) is now unable to resolve those stable paths for a value class enclosed in an object that are prefixed with identifier of the same enclosing object.

Test code:

package com.example.test

import org.mockito.{ ArgumentMatchersSugar, IdiomaticMockito }
import org.scalatest.{ FlatSpec, Matchers }

class NestedReproSpec extends FlatSpec with Matchers with IdiomaticMockito with ArgumentMatchersSugar {

  val exampler = mock[Exampler]

  it should "compile a nested value class with direct symbolic reference" in {
    import Nesting.NestedValueClass
    "exampler(any[NestedValueClass]) returns ???" should compile
  }

  it should "compile a nested value class with reference to enclosing object" in {
    "exampler(any[Nesting.NestedValueClass]) returns ???" should compile
  }
}

object Nesting {
  case class NestedValueClass(value: String) extends AnyVal
}

trait Exampler {
  def apply(v: Nesting.NestedValueClass): String
}

Result:

 NestedReproSpec:
 - should compile a nested value class with direct symbolic reference
 - should compile a nested value class with reference to enclosing object *** FAILED ***
   Expected no compiler error, but got the following type error: "not found: value NestedValueClass", for code: exampler(any[Nesting.NestedValueClass]) returns ??? (NestedReproSpec.scala:16)

Not 100% sure if the bug does not affect non-value-classes, but haven't seen such a case yet.

@ultrasecreth
Copy link
Member

Wow, thanks for that, 1.7.1 should fix it

Cheers!

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

No branches or pull requests

2 participants