Feedback
Explicit type arguments on generic method calls are not supported
- Status
- Fixed
- Fixed in
- v26.5.4
- Source discussion
- https://forum.objo.dev/d/39-some-questions
- Last updated
- 2026-05-17
Public summary
Generic method declarations are documented and accepted, but calling them with explicit type arguments fails.
Steps to reproduce:
Class Tester
Function TestFunction(Of T)(s As String) As T
Return Nothing
End Function
End Class
Var t As New Tester()
Var p2 As Person = t.TestFunction(Of Person)("test")
Expected:
t.TestFunction(Of Person)("test") should parse and type check, because T only appears in the return type and cannot be inferred from the argument list.
What happens:
The call errors. It looks like the compiler parses generic type parameters on method declarations, but internally CallExpression does not carry explicit generic type arguments for ordinary/global/member method calls. The IDE also currently lets users type TestFunction(Of T) into the method name field rather than modelling method type parameters separately, so this impacts both the compiler and the IDE.
Impact:
Generic methods whose type parameter is only used in the return type are effectively unusable from ObjoBasic, despite being in the language specification.