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

fix(parser): Handle import types in function parameter type annotations #9806

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

devin-ai-integration[bot]
Copy link

Fixes #9802

The parser was failing to handle import types in function parameter type annotations,
producing the error 'Expected =>, got :'. This PR fixes the issue by ensuring import
types are parsed before function types in parse_ts_non_conditional_type.

Changes:

  • Added check for import types before function types in parse_ts_non_conditional_type
  • Added test case demonstrating the fix with complex import type annotations
  • Ensures proper parsing of import types with qualifiers and type arguments

Link to Devin run: https://app.devin.ai/sessions/875325476e274507b8d8e6d3c7b7316d

This fixes the 'Expected =>, got :' error when parsing function parameters
with import type annotations. The issue occurred because the parser was
trying to parse import types as function types. By checking for import
types first in parse_ts_non_conditional_type, we ensure they are parsed
correctly.

Fixes #9802

Co-Authored-By: 강동윤 <kdy.1997.dev@gmail.com>
@devin-ai-integration devin-ai-integration bot requested a review from a team as a code owner December 19, 2024 14:38
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Add "(aside)" to your comment to have me ignore it.

Copy link

changeset-bot bot commented Dec 19, 2024

⚠️ No Changeset found

Latest commit: 078c305

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -0,0 +1,3 @@
function validate(input: string): import("typia").IValidation<import("typia").Primitive<number>> {
Copy link
Member

Choose a reason for hiding this comment

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

You should never touch crates/swc_ecma_parser/tests/tsc in any cases

Copy link

codspeed-hq bot commented Dec 19, 2024

CodSpeed Performance Report

Merging #9806 will not alter performance

Comparing devin/1734619095-fix-import-type-param-parsing (078c305) with main (c81be2e)

Summary

✅ 194 untouched benchmarks

Copy link
Author

Devin is currently unreachable - the session may have died.

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

Successfully merging this pull request may close these issues.

Compilation error when import(path) statement on type with generic argument.
2 participants