Skip to content

Prevent block types with references to local symbols #320

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
Feb 11, 2015

Conversation

smarter
Copy link
Member

@smarter smarter commented Dec 28, 2014

Review by @odersky


As an aside, the rules for block typing seem non-intuitive to me, the example from tests/pos/t1569a.scala works:

object Bug2 {
  class C { type T }
  class D extends C { type T = String }
  def foo(x: Int)(y: C)(z: y.T): Unit = {}
  foo(3)(new D)("hello")
}

But replacing new D by new D {} fails with:

tests/pos/t1569a.scala:11: error: type mismatch:
 found   : String("hello")
 required: Bug2.C#T
  foo(3)(new D { })("hello")
                    ^
one error found

smarter added a commit to smarter/dotty that referenced this pull request Jan 6, 2015
smarter added a commit to smarter/dotty that referenced this pull request Jan 6, 2015
For example, all anonymous classes have the same named type
TypeRef(NoPrefix, ANON_CLASS) but they should not subtype each other.

This commit will be submitted in a separate Pull-Request once scala#320 and
 scala#321 are fixed.
@odersky
Copy link
Contributor

odersky commented Feb 11, 2015

LGTM

@smarter
Copy link
Member Author

smarter commented Feb 11, 2015

Rebased, @odersky or @DarkDimius : please merge

DarkDimius added a commit that referenced this pull request Feb 11, 2015
Prevent block types with references to local symbols
@DarkDimius DarkDimius merged commit f1aa075 into scala:master Feb 11, 2015
tgodzik added a commit to tgodzik/scala3 that referenced this pull request Apr 29, 2025
Backport "fix: go to def should lead to all: apply, object and class" to 3.3 LTS
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