microsoft / yardl

Tooling for streaming instrument data
https://microsoft.github.io/yardl/
MIT License
30 stars 5 forks source link

Wrong error message in Python get_dtype for generic type missing type arguments #85

Closed naegelejd closed 11 months ago

naegelejd commented 11 months ago

This is a very minor bug, but it led to a necessary review of how the generated Python get_dtype function should work.

Given a model with an aliased, generic type:

GenericRecord<T>: !record
  fields:
    v: T

AliasedRecord<T>: GenericRecord<T>

If I call get_dtype on GenericRecord without specifying type arguments, I get a useful error message:

m.get_dtype(m.GenericRecord)
...
RuntimeError: Generic type arguments not provided for <class 'm.types.GenericRecord'>

But if I do the same for the aliased type, I do not get the same, expected error message:

m.get_dtype(m.AliasedRecord)
...
RuntimeError: Cannot find dtype for ~T

The user does not know what ~T is.