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

Generic Implements not working #676

Closed
mansellan opened this issue Jan 20, 2022 · 4 comments
Closed

Generic Implements not working #676

mansellan opened this issue Jan 20, 2022 · 4 comments
Labels
bug Something isn't working confirmed the issue has been verified

Comments

@mansellan
Copy link

Describe the bug
It's not possible to implement a generic interface (or class), or any non-generic interface which contains generic members.

To Reproduce

Public Interface SomeInterface(Of T)
    Sub SomeSub(Value As T) ' Unrecognised datatype symbol 'T'
End Interface

Public Class Set(Of T)
    Implements SomeInterface(Of T) ' Missing implementation of member Sub SomeSub(ByRef Value as {unresolved})

    Public Sub SomeInterface_SomeSub(Value As T)
    	Debug.Assert False
    End Sub
    
End Class

Expected behavior
Should be able to implement generic interfaces / members

Additional context
I've tried a few different ways to phrase this, but it seems like Implements only works on non generic types, and only if they don't contain any generic members.

Desktop (please complete the following information):

  • OS: Windows 10 (2004)
  • twinBASIC compiler version; v0.13.83
@WaynePhillipsEA WaynePhillipsEA added bug Something isn't working confirmed the issue has been verified labels Jan 20, 2022
@WaynePhillipsEA
Copy link
Collaborator

Unfortunately there isn't a quick-fix for this one. In fact, even attempting to use a non-generic interface with Implements inside a generic class is problematic at the moment (unless that interface is defined in a package or type library).

It needs some thought on how best to fix this, so I'll get back to you on it, but be warned it might be a little while until I get to it.

@WaynePhillipsEA
Copy link
Collaborator

Contrary to my earlier remarks, I have now solved this. However, I need to write more tests for it, so bear with me and it should be ready for tomorrow.

@WaynePhillipsEA
Copy link
Collaborator

Now fixed in v0.13.86, thanks for reporting!

Also fixed the Implements clause on generics, so that you can do Public Sub SomeSub(Value As T) Implements SomeInterface(Of T).SomeSub.

@mansellan
Copy link
Author

Wow, that's fast work! (I should be used to it by now...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed the issue has been verified
Projects
None yet
Development

No branches or pull requests

2 participants