migrator icon indicating copy to clipboard operation
migrator copied to clipboard

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

Open nex3 opened this issue 6 years ago • 2 comments

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.

nex3 avatar Oct 01 '19 00:10 nex3

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 avatar Apr 11 '23 01:04 nex3

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

nex3 avatar Apr 11 '23 01:04 nex3