6
votes

In the following code using 2.10.0M3 in Eclipse plugin 2.1.0 for 2.10M3. I'm using the default setting which is targeting JVM 1.5

class GeomBase[T <: DTypes] {          
  abstract class NewObjs {
    def newHex(gridR: GridBase, coodI: Cood): gridR.HexRT          
  }

  class GridBase {
    selfGrid =>
      type HexRT = HexG with T#HexTr

    def uniformRect (init: NewObjs) {
      val hexCood = Cood(2 ,2)
      val hex: HexRT = init.newHex(selfGrid, hexCood)//  won't compile
    }
  }
}

Error message:

Description Resource Path Location Type type mismatch;
  found: GeomBase.this.GridBase#HexG with T#HexTr
  required: GridBase.this.HexRT (which expands to) GridBase.this.HexG with T#HexTr GeomBase.scala   

Why does the compiler think the method returns the type projection GridBase#HexG when it should be this specific instance of GridBase?

Edit transferred to a simpler code class in responce to comments now getting a different error message.

package rStrat
class TestClass {
  abstract class NewObjs {
    def newHex(gridR: GridBase): gridR.HexG
  }     
  class GridBase {
    selfGrid =>         

    def uniformRect (init: NewObjs) {
      val hex: HexG = init.newHex(this) //error here                        
    }       

    class HexG {
      val test12 = 5                 
    }
  }
}

.

Error line 11:Description   Resource    Path    Location    Type
type mismatch;  found   : gridR.HexG  required: GridBase.this.HexG
possible cause: missing arguments for method or constructor TestClass.scala /SStrat/src/rStrat  line 11 Scala Problem

Update I've switched to 2.10.0M4 and updated the plug-in to the M4 version on a fresh version of Eclipse and switched to JVM 1.6 (and 1.7) but the problems are unchanged.

2
could you please add a working code example which produces the error message? - kiritsuku
You should paste the source code line with the error and the arrow that points to the exact location of the error that are also displayed. - Daniel C. Sobral
@RichOliver There should still be lines below that error. The line of code with the error itself, and, below it, a line with a single ^ character pointing to the error. - Daniel C. Sobral

2 Answers

4
votes

logged as SI-5958 - substitute this in dependent method type

2
votes

This now works as of 2.10.0M7. The bug has been fixed.

val hex: HexRT = init.newHex(selfGrid, hexCood) //now compiles and runs correctly