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

Relocate diagnostic from node to property. #2299

Closed
wants to merge 1 commit into from

Conversation

tjprescott
Copy link
Member

@github-actions
Copy link
Contributor

Changes in this PR will be published to the following url to try(check status of TypeSpec Pull Request Try It pipeline for publish status):
Playground: https://cadlplayground.z22.web.core.windows.net/prs/2299/

Website: https://cadlwebsite.z1.web.core.windows.net/prs/2299/

@azure-pipelines
Copy link

You can try these changes at https://cadlplayground.z22.web.core.windows.net/prs/2299/

Check the website changes at https://cadlwebsite.z1.web.core.windows.net/prs/2299/

@@ -1454,7 +1454,7 @@ export function createChecker(program: Program): Checker {
createDiagnostic({
code: "intersect-duplicate-property",
format: { propName: prop.name },
target: node,
target: prop,
Copy link
Member

Choose a reason for hiding this comment

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

how does it make it better for the trait issue?

This seems worse to me now, it shows the error somewhere far from usage.

https://cadlplayground.z22.web.core.windows.net/prs/2299/?c=bW9kZWwgQSB7CiAgZm9vOiBzdHJpbmc7Cn0KCsYcQtUcCmFsaWFzIEMgPSBBICYgQjs%3D&e=%40typespec%2Fopenapi3&options=%7B%7D

I think the solve the trait issue it need the underlying stacktrace of diagnostic so it can report the error higher up

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now it just displays the error on the import statement, which is the absolute worse. I can't find the underlying issue for that but I thought we had one. This was just an experiment to get the playground up so I could see the difference. If there's no easy fix, I'll just have to defer until that larger issue is fixed.

Copy link
Member

Choose a reason for hiding this comment

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

It shows at the top in the playground because it reports the error in another file that the main.tsp
If you run this code in the command line you get this
image

Issue in question to solve those #1321

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, perfect. In that case, I'll close this and leave that issue to address the stack trace.

@tjprescott tjprescott closed this Aug 15, 2023
@tjprescott tjprescott deleted the fixDuplicatePropertyTarget branch August 15, 2023 20:58
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.

2 participants