Boo
  1. Boo
  2. BOO-1167

BCE0149 on external method that has generic argument constraint referencing declaring type's external constructed generic argument

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Blocker Blocker
    • Resolution: Unresolved
    • Affects Version/s: 0.9
    • Fix Version/s: 0.9.5
    • Component/s: Compiler
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      External code:

      using System.Collections.Generic;
      public class D {
      }
      public class C<T> {
      	public IEnumerable<U> Do<U> () where U : T
      	{
      		return null;
      	}
      }
      

      Caller code:

      class B:
          pass
      C[of B]().Do[of B]() #B is internal, it works!
      
      C[of D]().Do[of D]() #D is external -> BCE0149 :(
      

      Gives:
      BCE0149: The type 'B' must derive from 'T' in order to substitute the generic parameter 'U' in 'C[of T].Do()'.

      Marking it Blocker for 0.9.1 as it blocks MonoDevelop guys wrt BooBinding.
      Thanks to Michael Hutchinson for reporting.

      FWIW, internal code works (testcase-worthy anyway):

      class B:
          pass
      class D (B):
          pass
      
      class C[of T]:
          def Do[of U(T)]() as U*:
              pass
      
      C[of B]().Do[of B]()
      

        Issue Links

          Activity

          Cedric Vivier made changes -
          Field Original Value New Value
          Link This issue is related to BOO-1166 [ BOO-1166 ]
          Cedric Vivier made changes -
          Summary BCE0149 on external generic method invocation that has generic argument constraint and declaring current type inherits a generic type BCE0149 on external generic method invocation that has generic argument constraint referencing declaring type constructed generic argument
          Description External code (we cannot have the same in BOO because of related BOO-1166):
          {code}
          using System.Collections.Generic;

          public class B
          {
          }
          public class A<T> where T : B {
          }
          public class C<T> : A<B> {
          public IEnumerable<U> Do<U> () where U : T
          {
          return null;
          }
          }
          {code}

          Caller code:
          {code}
          C[of B]().Do[of B]()
          {code}

          Gives:
          BCE0149: The type 'B' must derive from 'T' in order to substitute the generic parameter 'U' in 'C[of T].Do()'.


          Marking it Blocker for 0.9.1 as it blocks MonoDevelop guys wrt BooBinding.
          Thanks to Michael Hutchinson for reporting.
          External code:
          {code}
          using System.Collections.Generic;
          public class C<T> {
          public IEnumerable<U> Do<U> () where U : T
          {
          return null;
          }
          }
          {code}

          Caller code:
          {code}
          class B:
              pass
          C[of B]().Do[of B]()
          {code}

          Gives:
          BCE0149: The type 'B' must derive from 'T' in order to substitute the generic parameter 'U' in 'C[of T].Do()'.


          Marking it Blocker for 0.9.1 as it blocks MonoDevelop guys wrt BooBinding.
          Thanks to Michael Hutchinson for reporting.




          FWIW, internal code works (testcase-worthy anyway):
          {code}
          class B:
              pass
          class D (B):
              pass

          class C[of T]:
              def Do[of U(T)]() as U*:
                  pass

          C[of B]().Do[of B]()
          {code}
          Cedric Vivier made changes -
          Summary BCE0149 on external generic method invocation that has generic argument constraint referencing declaring type constructed generic argument BCE0149 on external method that has generic argument constraint referencing declaring type's external constructed generic argument
          Description External code:
          {code}
          using System.Collections.Generic;
          public class C<T> {
          public IEnumerable<U> Do<U> () where U : T
          {
          return null;
          }
          }
          {code}

          Caller code:
          {code}
          class B:
              pass
          C[of B]().Do[of B]()
          {code}

          Gives:
          BCE0149: The type 'B' must derive from 'T' in order to substitute the generic parameter 'U' in 'C[of T].Do()'.


          Marking it Blocker for 0.9.1 as it blocks MonoDevelop guys wrt BooBinding.
          Thanks to Michael Hutchinson for reporting.




          FWIW, internal code works (testcase-worthy anyway):
          {code}
          class B:
              pass
          class D (B):
              pass

          class C[of T]:
              def Do[of U(T)]() as U*:
                  pass

          C[of B]().Do[of B]()
          {code}
          External code:
          {code}
          using System.Collections.Generic;
          public class D {
          }
          public class C<T> {
          public IEnumerable<U> Do<U> () where U : T
          {
          return null;
          }
          }
          {code}

          Caller code:
          {code}
          class B:
              pass
          C[of B]().Do[of B]() #B is internal, it works!

          C[of D]().Do[of D]() #D is external -> BCE0149 :(
          {code}

          Gives:
          BCE0149: The type 'B' must derive from 'T' in order to substitute the generic parameter 'U' in 'C[of T].Do()'.


          Marking it Blocker for 0.9.1 as it blocks MonoDevelop guys wrt BooBinding.
          Thanks to Michael Hutchinson for reporting.




          FWIW, internal code works (testcase-worthy anyway):
          {code}
          class B:
              pass
          class D (B):
              pass

          class C[of T]:
              def Do[of U(T)]() as U*:
                  pass

          C[of B]().Do[of B]()
          {code}
          Rodrigo B. de Oliveira made changes -
          Fix Version/s 0.9.1 [ 14922 ]
          Fix Version/s 0.9.2 [ 15095 ]
          Rodrigo B. de Oliveira made changes -
          Fix Version/s 0.9.2 [ 15095 ]
          Fix Version/s 0.9.3 [ 15634 ]
          Rodrigo B. de Oliveira made changes -
          Assignee Cedric Vivier [ cedricv ] Rodrigo B. de Oliveira [ bamboo ]
          Rodrigo B. de Oliveira made changes -
          Fix Version/s 0.9.3 [ 15634 ]
          Fix Version/s 0.9.4 [ 16080 ]
          Rodrigo B. de Oliveira made changes -
          Fix Version/s 0.9.5 [ 17086 ]
          Fix Version/s 0.9.4 [ 16080 ]

            People

            • Assignee:
              Rodrigo B. de Oliveira
              Reporter:
              Cedric Vivier
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: