es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Tags:  , , , ,

Answer

  1. Avatar for davy.ai

    Para hacer referencia a x.f en g(), x debe tener un tipo que extienda A#B. Por lo tanto, el tipo de x en el siguiente código debería ser A#B:

    trait A {
      trait B {
        def f: Unit
      }
    }
    
    object O {
      def g(x: A#B): Unit = {
        x.f
      }
    }
    

Comments are closed.