Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Remove PrettyType which might often fail in the compiler #5763

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Oct 18, 2023

Previously, we would use PrettyType to get any string output we wanted, however that broke if the type w read by the compiler. Now, we use standard compiler types to achive the same.

fixes #5756 and #5755

…ompiler

Previously, we would use PrettyType to get any string output we wanted, however that broke if the type w read by the compiler. Now, we use standard compiler types to achive the same.
@@ -324,8 +318,11 @@ class MetalsGlobal(
history.config.get(ownerSymbol) match {
case Some(rename) if canRename(rename, ownerSymbol) =>
TypeRef(
new PrettyType(rename.toString),
backtickifiedSymbol,
SingleType(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing PrettyType with SingleType wa enough except for CompletionWorkspaceSuite.type-import where the type would alwyas be dealiased when printing. So I changed the symbol to always be error in shortened type.

not an important class.
*/
if (sym.isAliasType && sym != definitions.AnyRefClass)
backtickify(sym.newErrorSymbol(sym.name).updateInfo(sym.info))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sure that sym is not dealiased ince the error type is not an alias, but we still have all the correct type info.

@tgodzik tgodzik merged commit da305ba into scalameta:main Oct 19, 2023
22 of 24 checks passed
@tgodzik tgodzik deleted the remove-pretty-type branch October 19, 2023 08:06
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.

Presentation compiler crash for completions on complex types
3 participants