Skip to content

Throw an error for a member reference that refers to different members over time #99

Open
@nex3

Description

@nex3
Contributor

With @import, it's possible for a file to refer to a mixin or function that gets redefined later on. Right now References will just override the previous definition and treat it as though it always referred to whatever the last value was, but the more correct behavior would be to throw an error, since changing the definition isn't supported in the module system.

For example:

<==> input/entrypoint.scss
@import "definition1";
@import "upstream";
@import "midstream";

<==> input/definition1.scss
@function fn() {@return 1}

<==> input/definition2.scss
@function fn() {@return 2}

<==> input/midstream.scss
@import "definition2";
@import "upstream";

<==> input/upstream.scss
a {b: fn()}

I don't think this is worth fixing before we launch, though.

Activity

added
bugSomething isn't working
module systemPart of the module system migrator
on Oct 1, 2019
nex3

nex3 commented on Apr 11, 2023

@nex3
ContributorAuthor

Given that we're getting ready to start properly deprecating @import and this doesn't seem to be causing much user pain, I'm going to close it out as not planned.

nex3

nex3 commented on Apr 11, 2023

@nex3
ContributorAuthor

Oops, thought this was an issue on the implementation. For the migrator, we probably should handle this.

reopened this on Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmodule systemPart of the module system migrator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @nex3

      Issue actions

        Throw an error for a member reference that refers to different members over time · Issue #99 · sass/migrator