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

stale symbol in typeref (typeRef should rebind type aliases) #3731

Closed
scabug opened this issue Aug 5, 2010 · 3 comments
Closed

stale symbol in typeref (typeRef should rebind type aliases) #3731

scabug opened this issue Aug 5, 2010 · 3 comments
Assignees

Comments

@scabug
Copy link

scabug commented Aug 5, 2010

object Test{
  trait ZW[S]{type T}
  def ZipWith[S, M <: ZW[S]]: M#T = error("ZW")
  def meh[A] = ZipWith[A, ZW[A]{type T=Stream[A]}] // T-Def

  meh[Int]: Stream[Int]
}

scala-2.8.0-final says:

error: type mismatch;
 found   : Test.ZWSI-9200[IntSI-4392]{type TSI-11267 = StreamSI-3223[IntSI-4392]}#TSI-11016
 required: StreamSI-3223[IntSI-4392]
  meh[Int]: Stream[Int]
     ^

This should type check, though.

Rough explanation: after the prefix in the typeref M#T is updated to reflect the instantiation of the type arguments in meh[Int], the symbol that is used to refer to T is stale: it's still the symbol defined in the line marked with // T-Def

However, it should refer to the new symbol (not visible in the source code) that has A instantiated to Int.

@scabug
Copy link
Author

scabug commented Aug 5, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3731?orig=1
Reporter: @adriaanm

@scabug
Copy link
Author

scabug commented Sep 16, 2010

@adriaanm said:
(In r23010) closes #1569, #3731: refactored dependent method types to get rid of debruijn indices and use singleton types instead.

this is the core of the dependent types refactoring, no implicit or inference changes

(one baffling discovery: resultType should drop annotations that don't subclass TypeConstraint, even in the trivial case... wow -- thanks to Tiark for helping me figure it out on a terrace in Barcelona
TODO: probably need a more principled approach to the propagation of plugin type-annotations)

review by odersky

@scabug
Copy link
Author

scabug commented Sep 16, 2010

@adriaanm said:
(In r23011) part 2 of the dependent method refactoring: improved interaction with implicit search (needed for oopsla paper)

more to come in this area, see e.g. #3346 (stanford edsl stuff)

reopens SI-13, which wasn't fixed properly before imo, anyway (have a look at -Xprint:typer output before this commit: a type that's not expressible in surface syntax is inferred -- also removed duplicate test file)

closes #3731: co-evolve type alias type symbols when their rhs is updated and they are referenced by type selections (see typemap)

review by odersky

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