Closed vushu closed 1 year ago
template constraints are e.g. void foo(T : int)(T x)
constrained template arguments probably get resolved to the constraint type for auto-complete I guess?
You need to check on the function symbol if it has any if
constraints. We could probably store it in the bitflags that's mostly unused in the symbol.
Hmm okay I will try to take a look at it.
@WebFreak001 do you mean adding one more flag to SymbolQualifier
?
I meant a good place is probably the
// dfmt off
mixin(bitfields!(bool, "ownType", 1,
bool, "skipOver", 1,
ubyte, "", 6));
// dfmt on
e.g. having a
/* `true` if there is a template constraint, e.g. `if (is(T == foo))` that references this type */
bool, "isMentionedInTemplateConstraint", 1,
or maybe it would instead make more sense to have extra symbols as children of the template symbol, with a qualifier set to constraint.
What do you think?
@WebFreak001 I think I like the second idea since it stores more data, maybe we also can store the if parameters to further deduce if the cursorSymbol is allowed to use the function?
Im closing this and will come up with a solution for this.
@WebFreak001 I thought that CompletionKind.tmpTmpParam respected if statements before the function body, it states
symbol.d:105
type template parameter when no constraint, which should not included if's before function body?so I thought for that the example below was not included.
Since I mistook that, it is probably best to disable this feature.
Could we somehow use the compiler or dmd-fe to deduce template constraints?