Skip to content

Propagate deprecated attribute information on functions to Autocomplete entries#2159

Open
JohnnyMorganz wants to merge 9 commits intoluau-lang:masterfrom
JohnnyMorganz:deprecated-attribute-in-autocomplete
Open

Propagate deprecated attribute information on functions to Autocomplete entries#2159
JohnnyMorganz wants to merge 9 commits intoluau-lang:masterfrom
JohnnyMorganz:deprecated-attribute-in-autocomplete

Conversation

@JohnnyMorganz
Copy link
Copy Markdown
Contributor

@JohnnyMorganz JohnnyMorganz commented Dec 21, 2025

This PR fixes #2158 by checking the type information in an AutocompleteEntry to determine if it is a function (or intersection of functions) that is marked as deprecated. We then store this in the entry.deprecated field.

Alternatives considered

As seen in the commit history, my original thought was that we should propagate the deprecated attribute onto Bindings and Props. However, this end up having a couple of issues:

  • Should we be specifying deprecatedSuggestion in the Binding / Props. If so, how - should it be the same string constructed by the Linter?
  • In Linter.cpp, props.deprecated takes priority over the type-based deprecated information. This meant that we would regress in the deprecated information given, particularly the "reason" section (this didn't seem to get caught in unit tests?)
  • Handling of anonymous functions is a bit involved. We would need to propagate up the attribute on the anonymous function back to the AstStatAssign / AstStatLocal. We see a similar problem for aliased bindings.
  • This was not working for declared global functions. This was due to persistCheckedTypes in Frontend, which recreates the binding from scratch but only from type information.
  • How do we handle intersection of functions (e.g., in extern type where we declare multiple methods and one is deprecated but the others are not)

To me, it seems like the deprecated information on Bindings / Props is legacy and might be worthwhile to remove? Although we still need a way for the host to enforce deprecation for non-function members in props.

However, if you think it's better to take the binding / props approach, I can switch it around to that.

Fixes #2158

@JohnnyMorganz JohnnyMorganz changed the title Deprecated attribute in autocomplete Propagate deprecated attribute information on functions to Autocomplete entries Dec 21, 2025
@JohnnyMorganz
Copy link
Copy Markdown
Contributor Author

Failing test case is due to #2162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AutocompleteEntry deprecated not set if a function is marked with @deprecated attribute

1 participant