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 collision in QB with nested object & module names #900

Merged

Conversation

CarsonF
Copy link
Contributor

@CarsonF CarsonF commented Mar 9, 2024

Probably need tests, but wanted to get this up before the weekend.

Use full namespace in import

Previously these FQNs

A::X::Y
B::X::Y

were emitted as:

import _X from './A/X';
import _X from './B/X';

now they are emitted as:

import _AX from './A/X';
import _BX from './B/X';

I opted to use indentRef.name instead of path logic.
It just seemed easier, but I understand this is a deviation.
I'm open to changing.

Merged nested objects with nested modules (just like top level)

Previously these FQNs

A::B
A::B::C

were emitted as:

type __defaultExports = {
  "B": typeof B;
  "B": typeof _module__B;
};

Now these types & values are merged, just as in generateIndex.

Copy link
Collaborator

@scotttrinh scotttrinh left a comment

Choose a reason for hiding this comment

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

One blocking request: can we add a simple test maybe to https://github.com/edgedb/edgedb-js/blob/master/integration-tests/lts/objectTypes.test.ts to demonstrate the issue and the fix here?

packages/generate/src/builders.ts Outdated Show resolved Hide resolved
@CarsonF CarsonF force-pushed the bugfix/nested-object-module-collision branch 2 times, most recently from 1798993 to 06d8edf Compare March 11, 2024 21:19
@CarsonF CarsonF force-pushed the bugfix/nested-object-module-collision branch from 06d8edf to c568605 Compare March 11, 2024 21:31
Previously these FQNs
A::X::Y
B::X::Y

were emitted as:
import _X from './A/X';
import _X from './B/X';

now they are emitted as:
import _AX from './A/X';
import _BX from './B/X';

I opted to use `indentRef.name` instead of path logic.
It just seemed easier, but I understand this is a deviation.
Previously these FQNs
A::B
A::B::C

were emitted as:
type __defaultExports = {
  "B": typeof B;
  "B": typeof _module__B;
};

Now these types & values are merged, just as in generateIndex.
@CarsonF
Copy link
Contributor Author

CarsonF commented Mar 11, 2024

I added schema to produce the generation failures.
https://github.com/edgedb/edgedb-js/actions/runs/8240000012/job/22534457000?pr=900
CI passes in rebased commits.

@CarsonF CarsonF requested a review from scotttrinh March 11, 2024 21:42
@scotttrinh scotttrinh merged commit 5d4ee2b into edgedb:master Mar 12, 2024
7 of 8 checks passed
@CarsonF CarsonF deleted the bugfix/nested-object-module-collision branch March 12, 2024 00:10
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.

None yet

2 participants