Skip to content

Avoid spurious warnings about forward references in refinements #293

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

Merged
merged 1 commit into from
Dec 16, 2014

Conversation

smarter
Copy link
Member

@smarter smarter commented Dec 16, 2014

The warning was triggered by cases like:
class A
type F = A { type T = Int; def f: T }
Which is treated differently from the following which did not produce a warning:
type F = A { type T = Int } { def f: T }

Review by @odersky

@@ -759,10 +759,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
val refineClsDef = desugar.refinedTypeToClass(tpt1, tree.refinements)
val refineCls = createSymbol(refineClsDef).asClass
val TypeDef(_, Template(_, _, _, refinements1)) = typed(refineClsDef)
var seen = mutable.Set[Symbol]()
Copy link
Contributor

Choose a reason for hiding this comment

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

Since it's a mutable set, can be a val, not a var.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, thanks.

@odersky
Copy link
Contributor

odersky commented Dec 16, 2014

Otherwise LGTM.

The warning was triggered by cases like:
class A
type F = A { type T = Int; def f: T }
Which is treated differently from the following which did not produce a warning:
type F = A { type T = Int } { def f: T }
@smarter smarter force-pushed the fix/multiple-refinements-warning branch from ace49ca to 5fced3a Compare December 16, 2014 09:15
DarkDimius added a commit that referenced this pull request Dec 16, 2014
Avoid spurious warnings about forward references in refinements
@DarkDimius DarkDimius merged commit 78547d1 into scala:master Dec 16, 2014
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.

3 participants