scala - Type aliasing to avoid name clash in type refinement -


can use aliasing don't need change either of type parameter/member in following name clash situation:

trait bar {   type }  trait foo {   def get[a]: option[bar { type = }]  // "illegal cyclic reference" } 

i know can write

trait foo {   def get[a1]: option[bar { type = a1 }] } 

but prefer not change type name.

you e.g. this:

trait bar {   type }  trait foo {   type m[x] = bar { type = x }   def get[a]: option[m[a]] } 

or inline:

def get[a]: option[({ type x[y] = bar { type = y }})#x[a]] = ??? 

or, if prefer:

def get[a]: option[({ type a1 = a; type x = bar { type = a1 }})#x] = ??? 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -