Skip to content

Commit

Permalink
[Identical Conflict] No conflict errors for identical members (#2821)
Browse files Browse the repository at this point in the history
See #2820
  • Loading branch information
nex3 committed Feb 7, 2020
1 parent 44be8b5 commit 3ff2196
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
9 changes: 7 additions & 2 deletions spec/at-rules/forward.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ To execute a `@forward` rule `rule`:
* Otherwise, if `rule` has a `hide` clause that does include `name` (including
`$` for variables), do nothing.

* Otherwise, if another `@forward` rule's module has a member named `name`
with the same type as `member`, throw an error.
* If another `@forward` rule's module has a member named `name` with the same
type as `member`:

* If the other member is [identical to][] `member`, do nothing.

* Otherwise, throw an error.

* Otherwise, add `member` to [the current module][] with the name `name`.

Expand All @@ -96,4 +100,5 @@ To execute a `@forward` rule `rule`:
> if they're forwarded with prefixes multiple times.
[the current source file]: ../spec.md#current-source-file
[identical to]: ../modules.md#member
[the current module]: ../spec.md#current-module
16 changes: 10 additions & 6 deletions spec/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ implementation and is identified by a Sass identifier. This currently includes
selectors). All members have definitions associated with them, whose specific
structure depends on the type of the given member.

Two members are considered identical if they have the same name, type, source
location, and were defined in or forwarded from the same original module.

> Each member type has its own namespace in Sass, so for example the mixin
> `name` doesn't conflict with the function `name` or the variable `$name`.
Expand Down Expand Up @@ -401,19 +404,20 @@ and returns a member of type `type` or null.
[current import context]: spec.md#current-import-context

* Let `modules` be the set of [modules of][] the global `@use` rules in the
current source file which contain members of type `type` named `name`.
* Let `members` be the set of [unique][] members of type `type` named `name` in
[modules of][] the global `@use` rules.

[unique]: #member
[modules of]: at-rules/use.md#a-use-rules-module

* If the current import context contains a member `member` of type
`type` named `name`:
* If the current import context contains a member `member` of type `type` named
`name`:

* If `modules` is not empty, throw an error.
* If `members` is not empty, throw an error.

* Otherwise, return `member`.

* Otherwise, if `modules` contains more than one module, throw an error.
* Otherwise, if `members` contains more than one member, throw an error.

> This ensures that, if a new version of a library produces a conflicting
> name, it causes an immediate error.
Expand Down

0 comments on commit 3ff2196

Please sign in to comment.