C#: Refine UnboundGeneric and ConstructedGeneric#3341
Conversation
|
|
calumgrant
left a comment
There was a problem hiding this comment.
Good stuff - I think on balance this makes more sense than what was done previously.
| Generic() { | ||
| is_generic(this) or | ||
| is_constructed(this) | ||
| type_parameters(_, _, this, _) or |
There was a problem hiding this comment.
These lines are repeated in the derived QL classes. So perhaps make class Generic abstract?
There was a problem hiding this comment.
We tend to avoid abstract classes in the library, as it makes subclassing very hard.
| * the `T` will be the actual type parameter used for the `Other` that contains | ||
| * `g`, whereas in `class G<T> { ... }` the `T` is a formal type parameter of `G`. | ||
| * | ||
| * It is important not to get confused by the superficial syntactic similarity. |
There was a problem hiding this comment.
I'm not sure this line adds very much.
|
|
||
| @generic = @type | @method | @local_function; | ||
|
|
||
| is_generic(unique int id: @generic ref); |
There was a problem hiding this comment.
Do we need a corresponding DBscheme hash bump on master for odasa?
There was a problem hiding this comment.
Yes, I will open an internal PR as well.
e88a442 to
e8e27e0
Compare
Refine
UnboundGenericto only be those declarations that have type parameters, andConstructedGenericto only be those declarations that have type arguments.This change should not make a difference for
ConstructedGeneric, but forUnboundGenericit means that we no longer (incorrectly) consider non-generic nested types inside constructed types, such asA<int>.B, to beUnboundGenerics. (Such nested types do, however, still have relevant.getSourceDeclaration()s, for exampleA<>.B.)This change means that the relations
is_constructedandis_genericno longer are needed, so they have been removed.