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

Protected top-level definition can no longer be referenced in other file #18124

Closed
WojciechMazur opened this issue Jul 3, 2023 · 2 comments · Fixed by #18134
Closed

Protected top-level definition can no longer be referenced in other file #18124

WojciechMazur opened this issue Jul 3, 2023 · 2 comments · Fixed by #18134
Assignees
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore stat:needs spec
Milestone

Comments

@WojciechMazur
Copy link
Contributor

WojciechMazur commented Jul 3, 2023

Regression found in the Open Community Build in:

  • tinkoff/oolong - build logs - reproduction below

Compiler version

3.3.2-RC1-bin-20230629-90c59bd-NIGHTLY
Bisect points to 7c728bb from #18057

Minimized code

// definition.scala
package oolong.bson

trait BsonValue
protected def merge(
    base: BsonValue,
    patch: BsonValue,
    arraySubvalues: Boolean = false
): BsonValue = ???
// usage.scala
package oolong.bson

extension (bv: BsonValue)
  def :+(other: BsonValue): BsonValue = merge(other, bv, false)

Output

-- [E173] Reference Error: /Users/wmazur/projects/dotty/bisect/usage.scala:5:40 
5 |  def :+(other: BsonValue): BsonValue = merge(other, bv, false)
  |                                        ^^^^^
  |method merge in package oolong.bson cannot be accessed as a member of (oolong.bson: oolong.bson.type) from module class usage$package$.

Expectation

Probably should compile

@WojciechMazur WojciechMazur added itype:bug area:typer stat:needs spec regression This worked in a previous version but doesn't anymore labels Jul 3, 2023
@odersky
Copy link
Contributor

odersky commented Jul 4, 2023

Yes, should compile as long as the reference is in the same package as the definition.

@dwijnand
Copy link
Member

dwijnand commented Jul 4, 2023

Looks like the specs2 failure is the same issue: trying to access protected matcher.ResultChecks.checkResultFailure, while in the matcher package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore stat:needs spec
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants