Skip to content

weird errors - #3755

Open
bobzhang wants to merge 1 commit into
mainfrom
hongbo/weird_qualifed_error
Open

weird errors#3755
bobzhang wants to merge 1 commit into
mainfrom
hongbo/weird_qualifed_error

Conversation

@bobzhang

Copy link
Copy Markdown
Contributor
  1. from_array is an alias which is not imported
  2. from_iter also has a weird warning message
    git/core$moon check
    Error: [4021]
    ╭─[ /Users/hongbozhang/git/core/sorted_map/map_test.mbt:161:13 ]

    161 │ let map = from_array([(3, "c"), (2, "b"), (1, "a")])
    │ ─────┬────
    │ ╰────── The value identifier from_array is unbound.
    ─────╯
    Warning: [0020]
    ╭─[ /Users/hongbozhang/git/core/sorted_map/map_test.mbt:179:5 ]

    179 │ from_iter([(1, 1), (2, 2), (3, 3)].iter()),
    │ ────┬────
    │ ╰────── Warning (deprecated): Use SortedMap::from_iter instead.
    ─────╯
    Warning: [0025]
    ╭─[ /Users/hongbozhang/git/core/sorted_map/map_test.mbt:179:5 ]

    179 │ from_iter([(1, 1), (2, 2), (3, 3)].iter()),
    │ ────┬────
    │ ╰────── Warning (test_unqualified_package): from_iterator is implicitly imported in test. Use @sorted_map.from_iterator instead.
    ─────╯

1. from_array is an alias which is not imported
2. from_iter also has a weird warning message
git/core$moon check
Error: [4021]
     ╭─[ /Users/hongbozhang/git/core/sorted_map/map_test.mbt:161:13 ]
     │
 161 │   let map = from_array([(3, "c"), (2, "b"), (1, "a")])
     │             ─────┬────
     │                  ╰────── The value identifier from_array is unbound.
─────╯
Warning: [0020]
     ╭─[ /Users/hongbozhang/git/core/sorted_map/map_test.mbt:179:5 ]
     │
 179 │     from_iter([(1, 1), (2, 2), (3, 3)].iter()),
     │     ────┬────
     │         ╰────── Warning (deprecated): Use SortedMap::from_iter instead.
─────╯
Warning: [0025]
     ╭─[ /Users/hongbozhang/git/core/sorted_map/map_test.mbt:179:5 ]
     │
 179 │     from_iter([(1, 1), (2, 2), (3, 3)].iter()),
     │     ────┬────
     │         ╰────── Warning (test_unqualified_package): `from_iterator` is implicitly imported in test. Use `@sorted_map.from_iterator` instead.
─────╯

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts sorted_map tests to call from_array / from_iter without the @sorted_map. qualifier, seemingly intended to address reported import/deprecation warnings.

Changes:

  • Replaced @sorted_map.from_array(...) with from_array(...) in iter_collect test.
  • Replaced @sorted_map.from_iter(...) with from_iter(...) in from_iter multiple elements iter test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sorted_map/map_test.mbt
///|
test "iter_collect" {
let map = @sorted_map.from_array([(3, "c"), (2, "b"), (1, "a")])
let map = from_array([(3, "c"), (2, "b"), (1, "a")])
Comment thread sorted_map/map_test.mbt
test "from_iter multiple elements iter" {
debug_inspect(
@sorted_map.from_iter([(1, 1), (2, 2), (3, 3)].iter()),
from_iter([(1, 1), (2, 2), (3, 3)].iter()),
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