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(compiler): improve error diagnostic for invalid string concat #7025

Merged
merged 4 commits into from
Aug 19, 2024

Conversation

Chriscbr
Copy link
Contributor

@Chriscbr Chriscbr commented Aug 19, 2024

Adds a hint so if it looks like the user might want to try concatenating a non-string value onto a string, the error will suggest using string interpolation to coerce the other value into a string.

In the future we should also support directly converting values to strings: #741

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

@Chriscbr Chriscbr requested a review from a team as a code owner August 19, 2024 15:57
Copy link

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistance, don't hesitate to ping the relevant owner over Discord.

Topic Owner
Wing SDK and standard library @chriscbr
Wing Console @skyrpex
Wing compiler and language design @chriscbr
VSCode extension and language server @chriscbr
Wing CLI @chriscbr
Documentation @boyney123
Examples @boyney123
Wing Playground @skyrpex

@monadabot
Copy link
Contributor

monadabot commented Aug 19, 2024

Console preview environment is available at https://wing-console-pr-7025.fly.dev 🚀

Last Updated (UTC) 2024-08-19 16:16

@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Aug 19, 2024
@monadabot
Copy link
Contributor

Benchmarks

Comparison to Baseline ⬜🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 56ms±0.82 55ms±0.56 0ms (-0.8%)⬜
hello_world.test.w -t sim 403ms±2.85 416ms±14.7 +13ms (+3.32%)🟥
hello_world.test.w -t tf-aws 1489ms±5.24 1491ms±12 +2ms (+0.13%)⬜
jsii_big.test.w -t sim 2941ms±16.18 2953ms±13.61 +12ms (+0.41%)⬜
jsii_big.test.w -t tf-aws 3158ms±12.07 3160ms±15.41 +3ms (+0.09%)⬜
functions_1.test.w -t sim 407ms±7.02 407ms±5.49 0ms (-0.07%)⬜
functions_1.test.w -t tf-aws 852ms±6.92 862ms±7.62 +10ms (+1.17%)⬜
empty.test.w -t sim 368ms±3.04 368ms±3.18 +0ms (+0.09%)⬜
empty.test.w -t tf-aws 610ms±4.77 611ms±4.07 +1ms (+0.09%)⬜
functions_10.test.w -t sim 499ms±15.21 501ms±17.49 +3ms (+0.53%)⬜
functions_10.test.w -t tf-aws 2180ms±15.81 2169ms±17.24 -10ms (-0.47%)⬜
jsii_small.test.w -t sim 376ms±4.84 377ms±2.41 +0ms (+0.1%)⬜
jsii_small.test.w -t tf-aws 620ms±3.28 619ms±3.75 0ms (-0.08%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 55ms 54ms 57ms 1ms 1ms
hello_world.test.w -t sim 416ms 400ms 459ms 15ms 21ms
hello_world.test.w -t tf-aws 1491ms 1470ms 1528ms 12ms 17ms
jsii_big.test.w -t sim 2953ms 2918ms 2979ms 14ms 19ms
jsii_big.test.w -t tf-aws 3160ms 3129ms 3192ms 15ms 22ms
functions_1.test.w -t sim 407ms 395ms 421ms 5ms 8ms
functions_1.test.w -t tf-aws 862ms 851ms 887ms 8ms 11ms
empty.test.w -t sim 368ms 360ms 375ms 3ms 4ms
empty.test.w -t tf-aws 611ms 598ms 617ms 4ms 6ms
functions_10.test.w -t sim 501ms 436ms 524ms 17ms 24ms
functions_10.test.w -t tf-aws 2169ms 2139ms 2212ms 17ms 24ms
jsii_small.test.w -t sim 377ms 372ms 383ms 2ms 3ms
jsii_small.test.w -t tf-aws 619ms 610ms 627ms 4ms 5ms
Last Updated (UTC) 2024-08-19 16:22

@Chriscbr Chriscbr removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Aug 19, 2024
@Chriscbr Chriscbr merged commit 75ca07a into main Aug 19, 2024
13 checks passed
@Chriscbr Chriscbr deleted the rybickic/concat-hint branch August 19, 2024 20:37
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.82.8.

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