Scala Programming Language
  1. Scala Programming Language
  2. SI-5305

Imported type not in scope in a type refinement in particular syntactic context (regression)

    Details

      Description

      Used to work in 2.8.1. Broken in 2.9.1 and 2.10-SNAPSHOT.

      object Bug {
        def in(a: Any) = {}
      
        object O {
          type F = Int
        }
      
        in {
          import O.F
          type x = {type l = F} // not found: type F
        }
      
        //
        // All of the below work.
        //
      
        in {
          import O.F
          type x1 = F
          type x2 = {type l = O.F}
        }
      
        def locally[T](x: T): T  = x
      
        locally {
          import O.F
          type x3 = {type l = F}
        }
      
        {
          import O.F
          type x3 = {type l = F}
        }
      }
      

        Activity

        Hide
        Jason Zaugg added a comment -

        I believe that this was introduced:

        https://github.com/scala/scala/commit/e5cfe47#L1R2097

        The refinement is typed with an outer context that doesn't include the import of `O.F`.

        Show
        Jason Zaugg added a comment - I believe that this was introduced: https://github.com/scala/scala/commit/e5cfe47#L1R2097 The refinement is typed with an outer context that doesn't include the import of `O.F`.
        Hide
        Jason Zaugg added a comment - - edited

        I've prototyped a fix, but it warrants review before merging, as I don't trust the test coverage.

        https://github.com/retronym/scala/compare/master...ticket/5305

        Show
        Jason Zaugg added a comment - - edited I've prototyped a fix, but it warrants review before merging, as I don't trust the test coverage. https://github.com/retronym/scala/compare/master...ticket/5305
        Hide
        Jason Zaugg added a comment -

        Martin included you on the review list for the commit he made that I've partially reverted here. So I'll volley this ticket in your direction.

        See:

        https://issues.scala-lang.org/browse/SI-3614?focusedCommentId=50477&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-50477

        And the comments in:

        https://github.com/retronym/scala/commit/f5df207f

        Show
        Jason Zaugg added a comment - Martin included you on the review list for the commit he made that I've partially reverted here. So I'll volley this ticket in your direction. See: https://issues.scala-lang.org/browse/SI-3614?focusedCommentId=50477&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-50477 And the comments in: https://github.com/retronym/scala/commit/f5df207f

          People

          • Assignee:
            Adriaan Moors
            Reporter:
            Jason Zaugg
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development