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

Class does not conform to self-type #5402

Closed
scabug opened this issue Jan 24, 2012 · 1 comment
Closed

Class does not conform to self-type #5402

scabug opened this issue Jan 24, 2012 · 1 comment

Comments

@scabug
Copy link

scabug commented Jan 24, 2012

Given this code:

  trait TFn1B {
    type In
    type Out
    type Apply[T <: In] <: Out
  }

  trait TFn1[I, O] extends TFn1B {
    type In = I
    type Out = O
  }

  trait >>[F1 <: TFn1[_, _], F2 <: TFn1[_, _]] extends TFn1[F1#In, F2#Out] {
    type Apply[T] = F2#Apply[F1#Apply[T]]
  }

The following error is produced:

<console>:9: error: illegal inheritance;
 self-type >>[F1,F2] does not conform to TFn1[_$1,_$4]'s selftype TFn1[_$1,_$4]
         trait >>[F1 <: TFn1[_, _], F2 <: TFn1[_, _]] extends TFn1[F1#In, F2#Out] {
                                                              ^
>>[F1,F2] <: TFn1[_$1,_$4]?
  TFn1[_$1,_$4] <: TFn1[_$1,_$4]?
    _$1 <: _$1?
      _$1 <: Nothing?
        <notype> <: Nothing?
        false
        Any <: Nothing?
          <notype> <: Nothing?
          false
        false
      false
      Any <: _$1?
        Any <: Nothing?
          <notype> <: Nothing?
          false
        false
      false
    false
  false
false

If find it highly suspicious that it cannot prove that _$1 <: _$1. Also, there isn't any constraints on the type parameters for TFn1, so I don't see how it could reject the inheritance (the type declaration seems in error, but it doesn't complain about that).

This was reported on Stack Overflow in this question.

@scabug
Copy link
Author

scabug commented Jan 24, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5402?orig=1
Reporter: @dcsobral
Affected Versions: 2.10.0
Duplicates #5399

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant