diff --git a/js-api-spec/value/boolean.test.ts b/js-api-spec/value/boolean.test.ts index c830e8f259..2d2dd98c2e 100644 --- a/js-api-spec/value/boolean.test.ts +++ b/js-api-spec/value/boolean.test.ts @@ -30,6 +30,7 @@ describe('Sass boolean', () => { expect(value.assertFunction).toThrow(); expect(value.assertMap).toThrow(); expect(value.tryMap()).toBe(null); + expect(value.assertMixin).toThrow(); expect(value.assertNumber).toThrow(); expect(value.assertString).toThrow(); }); @@ -60,6 +61,7 @@ describe('Sass boolean', () => { expect(value.assertFunction).toThrow(); expect(value.assertMap).toThrow(); expect(value.tryMap()).toBe(null); + expect(value.assertMixin).toThrow(); expect(value.assertNumber).toThrow(); expect(value.assertString).toThrow(); }); diff --git a/js-api-spec/value/calculation.test.ts b/js-api-spec/value/calculation.test.ts index b738ed10de..2990b9c319 100644 --- a/js-api-spec/value/calculation.test.ts +++ b/js-api-spec/value/calculation.test.ts @@ -48,6 +48,7 @@ describe('SassCalculation', () => { expect(() => calculation.assertFunction()).toThrow(); expect(() => calculation.assertMap()).toThrow(); expect(calculation.tryMap()).toBe(null); + expect(() => calculation.assertMixin()).toThrow(); expect(() => calculation.assertNumber()).toThrow(); expect(() => calculation.assertString()).toThrow(); }); diff --git a/js-api-spec/value/color.test.ts b/js-api-spec/value/color.test.ts index 1a6c6bfa21..c816c67c7c 100644 --- a/js-api-spec/value/color.test.ts +++ b/js-api-spec/value/color.test.ts @@ -57,6 +57,7 @@ describe('SassColor', () => { expect(() => color.assertFunction()).toThrow(); expect(() => color.assertMap()).toThrow(); expect(color.tryMap()).toBe(null); + expect(() => color.assertMixin()).toThrow(); expect(() => color.assertNumber()).toThrow(); expect(() => color.assertString()).toThrow(); }); diff --git a/js-api-spec/value/list.test.ts b/js-api-spec/value/list.test.ts index e7d784fcad..930ef01d9f 100644 --- a/js-api-spec/value/list.test.ts +++ b/js-api-spec/value/list.test.ts @@ -30,6 +30,7 @@ describe('SassList', () => { expect(() => list.assertFunction()).toThrow(); expect(() => list.assertMap()).toThrow(); expect(list.tryMap()).toBe(null); + expect(() => list.assertMixin()).toThrow(); expect(() => list.assertNumber()).toThrow(); expect(() => list.assertString()).toThrow(); }); @@ -358,6 +359,7 @@ describe('SassList', () => { expect(() => list.assertCalculation()).toThrow(); expect(() => list.assertColor()).toThrow(); expect(() => list.assertFunction()).toThrow(); + expect(() => list.assertMixin()).toThrow(); expect(() => list.assertNumber()).toThrow(); expect(() => list.assertString()).toThrow(); }); diff --git a/js-api-spec/value/map.test.ts b/js-api-spec/value/map.test.ts index 36a3716a31..c185b00d03 100644 --- a/js-api-spec/value/map.test.ts +++ b/js-api-spec/value/map.test.ts @@ -32,6 +32,7 @@ describe('SassMap', () => { expect(() => map.assertCalculation()).toThrow(); expect(() => map.assertColor()).toThrow(); expect(() => map.assertFunction()).toThrow(); + expect(() => map.assertMixin()).toThrow(); expect(() => map.assertNumber()).toThrow(); expect(() => map.assertString()).toThrow(); }); diff --git a/js-api-spec/value/mixin.test.ts b/js-api-spec/value/mixin.test.ts new file mode 100644 index 0000000000..a1413bfa8f --- /dev/null +++ b/js-api-spec/value/mixin.test.ts @@ -0,0 +1,46 @@ +// Copyright 2021 Google Inc. Use of this source code is governed by an +// MIT-style license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT. + +import {SassMixin, compileString} from 'sass'; + +import {spy} from '../utils'; + +it('can round-trip a mixin reference from Sass', () => { + const fn = spy(args => { + expect(args).toBeArrayOfSize(1); + const value = args[0]; + expect(value).toBeInstanceOf(SassMixin); + expect(value.assertCalculation).toThrow(); + expect(value.assertColor).toThrow(); + expect(value.assertFunction).toThrow(); + expect(value.assertMap).toThrow(); + expect(value.tryMap()).toBe(null); + expect(value.assertMixin()).toBe(value); + expect(value.assertNumber).toThrow(); + expect(value.assertString).toThrow(); + + return value; + }); + + expect( + compileString( + ` + @use 'sass:meta'; + + @mixin a() { + a { + b: c; + } + } + + @include meta.apply(foo(meta.get-mixin('a'))); + `, + { + functions: {'foo($arg)': fn}, + } + ).css + ).toBe('a {\n b: c;\n}'); + + expect(fn).toHaveBeenCalled(); +}); diff --git a/js-api-spec/value/null.test.ts b/js-api-spec/value/null.test.ts index 2ed3d37df9..dcfbe13c52 100644 --- a/js-api-spec/value/null.test.ts +++ b/js-api-spec/value/null.test.ts @@ -30,6 +30,7 @@ describe('Sass null', () => { expect(value.assertFunction).toThrow(); expect(value.assertMap).toThrow(); expect(value.tryMap()).toBe(null); + expect(value.assertMixin).toThrow(); expect(value.assertNumber).toThrow(); expect(value.assertString).toThrow(); }); diff --git a/js-api-spec/value/number.test.ts b/js-api-spec/value/number.test.ts index f2493821be..00656a375d 100644 --- a/js-api-spec/value/number.test.ts +++ b/js-api-spec/value/number.test.ts @@ -42,6 +42,7 @@ describe('Sass number', () => { expect(() => number.assertFunction()).toThrow(); expect(() => number.assertMap()).toThrow(); expect(number.tryMap()).toBe(null); + expect(() => number.assertMixin()).toThrow(); expect(() => number.assertString()).toThrow(); }); }); diff --git a/js-api-spec/value/string.test.ts b/js-api-spec/value/string.test.ts index abe4fc2135..061089529b 100644 --- a/js-api-spec/value/string.test.ts +++ b/js-api-spec/value/string.test.ts @@ -59,6 +59,7 @@ describe('Sass string', () => { expect(value.assertFunction).toThrow(); expect(value.assertMap).toThrow(); expect(value.tryMap()).toBe(null); + expect(value.assertMixin).toThrow(); expect(value.assertNumber).toThrow(); }); }); diff --git a/spec/core_functions/meta/accepts_content.hrx b/spec/core_functions/meta/accepts_content.hrx new file mode 100644 index 0000000000..b25a1b8624 --- /dev/null +++ b/spec/core_functions/meta/accepts_content.hrx @@ -0,0 +1,138 @@ +<===> options.yml +--- +:todo: +- sass/libsass#2807 + +<===> +================================================================================ +<===> accepts/direct_child/input.scss +@use "sass:meta"; + +@mixin a() {@content} + +a {b: meta.accepts-content(meta.get-mixin("a"))} + +<===> accepts/direct_child/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> accepts/nested_child/input.scss +@use "sass:meta"; + +@mixin a() { + @if false {@content} +} + +a {b: meta.accepts-content(meta.get-mixin("a"))} + +<===> accepts/nested_child/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> accepts/builtin/input.scss +@use "sass:meta"; + +a {b: meta.accepts-content(meta.get-mixin(apply, meta))} + +<===> accepts/builtin/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> doesnt_accept/empty/input.scss +@use "sass:meta"; +@mixin a() {} + +a {b: meta.accepts-content(meta.get-mixin("a"))} + +<===> doesnt_accept/empty/output.css +a { + b: false; +} + +<===> +================================================================================ +<===> doesnt_accept/builtin/input.scss +@use "sass:meta"; +@mixin a() {} + +a {b: meta.accepts-content(meta.get-mixin(load-css, meta))} + +<===> doesnt_accept/builtin/output.css +a { + b: false; +} + +<===> +================================================================================ +<===> args/keyword/input.scss +@use "sass:meta"; + +a {b: meta.accepts-content($mixin: meta.get-mixin(apply, meta))} + +<===> args/keyword/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> error/args/too_few/input.scss +@use "sass:meta"; + +a {b: meta.accepts-content()} + +<===> error/args/too_few/error +Error: Missing argument $mixin. + ,--> input.scss +3 | a {b: meta.accepts-content()} + | ^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + ,--> sass:meta +1 | @function accepts-content($mixin) { + | ======================= declaration + ' + input.scss 3:7 root stylesheet + +<===> +================================================================================ +<===> error/args/too_many/input.scss +@use "sass:meta"; +@mixin a() {} + +a {b: meta.accepts-content(a, a)} + +<===> error/args/too_many/error +Error: Only 1 argument allowed, but 2 were passed. + ,--> input.scss +4 | a {b: meta.accepts-content(a, a)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + ,--> sass:meta +1 | @function accepts-content($mixin) { + | ======================= declaration + ' + input.scss 4:7 root stylesheet + +<===> +================================================================================ +<===> error/args/wrong_type/input.scss +@use "sass:meta"; + +a {b: meta.accepts-content(meta.get-function("red"))} + +<===> error/args/wrong_type/error +Error: $mixin: get-function("red") is not a mixin reference. + , +3 | a {b: meta.accepts-content(meta.get-function("red"))} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 3:7 root stylesheet diff --git a/spec/core_functions/meta/apply.hrx b/spec/core_functions/meta/apply.hrx new file mode 100644 index 0000000000..f7a5aaf40f --- /dev/null +++ b/spec/core_functions/meta/apply.hrx @@ -0,0 +1,275 @@ +<===> options.yml +--- +:todo: +- sass/libsass#2807 + +<===> +================================================================================ +<===> args/named/input.scss +@use "sass:meta"; + +@mixin a { + b: c; +} + +a {@include meta.apply($mixin: meta.get-mixin("a"))} + +<===> args/named/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> args/passes/positional/input.scss +@use "sass:meta"; + +@mixin a($a) {b: $a} + +a {@include meta.apply(meta.get-mixin("a"), c)} + +<===> args/passes/positional/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> args/passes/named/input.scss +@use "sass:meta"; + +@mixin a($a) {b: $a} + +a {@include meta.apply(meta.get-mixin("a"), $a: c)} + +<===> args/passes/named/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> args/passes/rest/positional/input.scss +@use "sass:meta"; + +@mixin a($a...) {b: $a} + +a {@include meta.apply(meta.get-mixin("a"), a, b, c)} + +<===> args/passes/rest/positional/output.css +a { + b: a, b, c; +} + +<===> +================================================================================ +<===> args/passes/rest/named/input.scss +@use "sass:meta"; + +@mixin a($a...) {b: meta.inspect(meta.keywords($a))} + +a {@include meta.apply(meta.get-mixin("a"), $a: a, $b: b, $c: c)} + +<===> args/passes/rest/named/output.css +a { + b: (a: a, b: b, c: c); +} + +<===> +================================================================================ +<===> rest/mixin-separate/positional/input.scss +@use "sass:meta"; + +@mixin a($a, $b) {b: $a, $b} + +$rest: 1 2; +a {@include meta.apply(meta.get-mixin("a"), $rest...)} + +<===> rest/mixin-separate/positional/output.css +a { + b: 1, 2; +} + +<===> +================================================================================ +<===> rest/mixin-separate/named/input.scss +@use "sass:meta"; + +@mixin a($a, $b) {b: $a, $b} + +$rest: (a: 1, b: 2); +a {@include meta.apply(meta.get-mixin("a"), $rest...)} + +<===> rest/mixin-separate/named/output.css +a { + b: 1, 2; +} + +<===> +================================================================================ +<===> rest/includes-mixin/positional/input.scss +@use "sass:meta"; + +@mixin a($a, $b) {b: $a, $b} + +$rest: meta.get-mixin("a") 1 2; +a {@include meta.apply($rest...)} + +<===> rest/includes-mixin/positional/output.css +a { + b: 1, 2; +} + +<===> +================================================================================ +<===> rest/includes-mixin/named/input.scss +@use "sass:meta"; + +@mixin a($a, $b) {b: $a, $b} + +$rest: (mixin: meta.get-mixin("a"), a: 1, b: 2); +a {@include meta.apply($rest...)} + +<===> rest/includes-mixin/named/output.css +a { + b: 1, 2; +} + +<===> +================================================================================ +<===> error/wrong_named_arg/input.scss +@use "sass:meta"; + +@mixin a($a) {b: $a} + +a {@include meta.apply(meta.get-mixin("a"), $b: c)} + +<===> error/wrong_named_arg/error +Error: Missing argument $a. + , +3 | @mixin a($a) {b: $a} + | ===== declaration +... | +5 | a {@include meta.apply(meta.get-mixin("a"), $b: c)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + input.scss 5:4 a() + input.scss 5:4 root stylesheet + +<===> +================================================================================ +<===> error/use_as_function/input.scss +@use "sass:meta"; + +@mixin a {} +$a: meta.get-mixin("a"); + +a {b: meta.apply($a)} + +<===> error/use_as_function/error +Error: Undefined function. + , +6 | a {b: meta.apply($a)} + | ^^^^^^^^^^^^^^ + ' + input.scss 6:7 root stylesheet + +<===> +================================================================================ +<===> error/no_args/input.scss +@use "sass:meta"; + +a {@include meta.apply()} + +<===> error/no_args/error +Error: Missing argument $mixin. + ,--> input.scss +3 | a {@include meta.apply()} + | ^^^^^^^^^^^^^^^^^^^^^ invocation + ' + ,--> sass:meta +1 | @mixin apply($mixin, $args...) { + | ======================= declaration + ' + input.scss 3:4 root stylesheet + +<===> +================================================================================ +<===> error/wrong_arg_type/input.scss +@use "sass:meta"; + +a {@include meta.apply(2px)} + +<===> error/wrong_arg_type/error +Error: $mixin: 2px is not a mixin reference. + , +3 | a {@include meta.apply(2px)} + | ^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 3:4 root stylesheet + +<===> +================================================================================ +<===> error/too_many_args/input.scss +@use "sass:meta"; + +@mixin a {} +$a: meta.get-mixin("a"); + +a {@include meta.apply($a, 2px)} + +<===> error/too_many_args/error +Error: Only 0 arguments allowed, but 1 was passed. + , +3 | @mixin a {} + | = declaration +... | +6 | a {@include meta.apply($a, 2px)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + input.scss 6:4 a() + input.scss 6:4 root stylesheet + +<===> +================================================================================ +<===> error/missing_mixin_args/input.scss +@use "sass:meta"; + +@mixin a($a) {} +$a: meta.get-mixin("a"); + +a {@include meta.apply($a)} + +<===> error/missing_mixin_args/error +Error: Missing argument $a. + , +3 | @mixin a($a) {} + | ===== declaration +... | +6 | a {@include meta.apply($a)} + | ^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + input.scss 6:4 a() + input.scss 6:4 root stylesheet + +<===> +================================================================================ +<===> error/too_many_args_mixin_accepts_args/input.scss +@use "sass:meta"; + +@mixin a($a) {} +$a: meta.get-mixin("a"); + +a {@include meta.apply($a, 2px, 3px)} + +<===> error/too_many_args_mixin_accepts_args/error +Error: Only 1 argument allowed, but 2 were passed. + , +3 | @mixin a($a) {} + | ===== declaration +... | +6 | a {@include meta.apply($a, 2px, 3px)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + input.scss 6:4 a() + input.scss 6:4 root stylesheet diff --git a/spec/core_functions/meta/get_mixin/content.hrx b/spec/core_functions/meta/get_mixin/content.hrx new file mode 100644 index 0000000000..ee2afbea36 --- /dev/null +++ b/spec/core_functions/meta/get_mixin/content.hrx @@ -0,0 +1,168 @@ +<===> passes_content/input.scss +@use "sass:meta"; + +@mixin a { + b {@content} +} + +a { + @include meta.apply(meta.get-mixin("a")) { + b: red; + } +} + +<===> passes_content/output.css +a b { + b: red; +} + +<===> +================================================================================ +<===> passes_empty_content/input.scss +@use "sass:meta"; + +@mixin a {@content;} + +a { + @include meta.apply(meta.get-mixin("a")) {} +} + +<===> passes_empty_content/output.css + +<===> +================================================================================ +<===> scope/redeclare/vars/input.scss +@use "sass:meta"; +@mixin a($param: param) { + $in-mixin: in-mixin; + @content; + param: $param; + in-mixin: $in-mixin; +} + +$global: global; + +a { + $in-style-rule: in-style-rule; + @include meta.apply(meta.get-mixin("a")) { + $param: in-include; + $in-mixin: in-include; + $global: in-include; + $in-style-rule: in-include; + } + global: $global; + in-style-rule: $in-style-rule; +} + +<===> scope/redeclare/vars/output.css +a { + param: param; + in-mixin: in-mixin; + global: global; + in-style-rule: in-include; +} + +<===> +================================================================================ +<===> scope/redeclare/using/input.scss +@use "sass:meta"; +@mixin a($a: param) {@content(content-arg);} + +$a: global; + +a { + $a: in-style-rule; + @include meta.apply(meta.get-mixin("a")) using ($a) { + in-content-body: $a; + $a: in-content-body; + } + in-style-rule: $a; +} + +<===> scope/redeclare/using/output.css +a { + in-content-body: content-arg; + in-style-rule: in-style-rule; +} + +<===> +================================================================================ +<===> scope/fall_through/input.scss +@use "sass:meta"; +$global: global; + +@mixin a { + @content(content-rule-a); + global: $global; +} + +@mixin b { + $global: in-mixin-b; + @include meta.apply(meta.get-mixin(a)) using ($content-arg) { + @content($content-arg); + } +} + +@mixin c { + $global: in-mixin-c; + @include meta.apply(meta.get-mixin(b)) using ($content-arg) { + @content($content-arg); + } +} + +a { + $global: in-style-rule; + @include meta.apply(meta.get-mixin(c)) using ($content-arg) { + in-content-body: $content-arg; + } +} + +<===> scope/fall_through/output.css +a { + in-content-body: content-rule-a; + global: global; +} + +<===> +================================================================================ +<===> error/denies_content/user_defined/input.scss +@use "sass:meta"; +@mixin a {} + +a { + @include meta.apply(meta.get-mixin("a")) {} +} + +<===> error/denies_content/user_defined/error +Error: Mixin doesn't accept a content block. + , +2 | @mixin a {} + | = declaration +... | +5 | @include meta.apply(meta.get-mixin("a")) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + input.scss 5:3 root stylesheet + +<===> +================================================================================ +<===> error/denies_content/builtin/input.scss +@use "sass:meta"; + +a { + @include meta.apply(meta.get-mixin(load-css, meta), "a") { + a: b; + } +} + +<===> error/denies_content/builtin/error +Error: Mixin doesn't accept a content block. + ,--> input.scss +4 | @include meta.apply(meta.get-mixin(load-css, meta), "a") { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + ,--> sass:meta +1 | @mixin load-css($url, $with: null) { + | =========================== declaration + ' + input.scss 4:3 root stylesheet diff --git a/spec/core_functions/meta/get_mixin/different_module.hrx b/spec/core_functions/meta/get_mixin/different_module.hrx new file mode 100644 index 0000000000..a963879124 --- /dev/null +++ b/spec/core_functions/meta/get_mixin/different_module.hrx @@ -0,0 +1,129 @@ +<===> defined/input.scss +@use "sass:meta"; +@use "other"; +a {@include meta.apply(meta.get-mixin("a", $module: "other"), #abcdef)} + +<===> defined/_other.scss +@mixin a($color) {b: red($color)} + +<===> defined/output.css +a { + b: 171; +} + +<===> +================================================================================ +<===> chosen_prefix/input.scss +@use "sass:meta"; +@use "other" as a; +b {@include meta.apply(meta.get-mixin("a", $module: "a"), #abcdef)} + +<===> chosen_prefix/_other.scss +@mixin a($color) {c: red($color)} + +<===> chosen_prefix/output.css +b { + c: 171; +} + +<===> +================================================================================ +<===> through_use/input.scss +@use "sass:meta"; +@use "other" as *; +a {@include meta.apply(meta.get-mixin(add-two), 10)} + +<===> through_use/other.scss +@mixin add-two($v) {b: $v + 2} + +<===> through_use/output.css +a { + b: 12; +} + +<===> +================================================================================ +<===> through_forward/bare/input.scss +@use "sass:meta"; +@use "midstream" as *; +a {@include meta.apply(meta.get-mixin(c))} + +<===> through_forward/bare/_midstream.scss +@forward "upstream"; + +<===> through_forward/bare/_upstream.scss +@mixin c() {b: c} + +<===> through_forward/bare/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> through_forward/as/input.scss +@use "sass:meta"; +@use "midstream" as *; +a {@include meta.apply(meta.get-mixin(c-d))} + +<===> through_forward/as/_midstream.scss +@forward "upstream" as c-*; + +<===> through_forward/as/_upstream.scss +@mixin d() {b: d} + +<===> through_forward/as/output.css +a { + b: d; +} + +<===> +================================================================================ +<===> through_forward/show/input.scss +@use "sass:meta"; +@use "midstream" as *; +a {@include meta.apply(meta.get-mixin(c))} + +<===> through_forward/show/_midstream.scss +@forward "upstream" show c; + +<===> through_forward/show/_upstream.scss +@mixin c() {b: c} + +<===> through_forward/show/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> through_forward/hide/input.scss +@use "sass:meta"; +@use "midstream" as *; +a {@include meta.apply(meta.get-mixin(d))} + +<===> through_forward/hide/_midstream.scss +@forward "upstream" hide c; + +<===> through_forward/hide/_upstream.scss +@mixin d() {b: d} + +<===> through_forward/hide/output.css +a { + b: d; +} + +<===> +================================================================================ +<===> named/input.scss +@use "sass:meta"; +@use "other"; +a {@include meta.apply(meta.get-mixin($name: "a", $module: "other"), #abcdef)} + +<===> named/_other.scss +@mixin a($color) {b: red($color)} + +<===> named/output.css +a { + b: 171; +} diff --git a/spec/core_functions/meta/get_mixin/equality.hrx b/spec/core_functions/meta/get_mixin/equality.hrx new file mode 100644 index 0000000000..6e0e0736dc --- /dev/null +++ b/spec/core_functions/meta/get_mixin/equality.hrx @@ -0,0 +1,73 @@ +<===> same_value/input.scss +@use "sass:meta"; +@mixin a() {} +$a: meta.get-mixin(a); +a {b: $a == $a} + +<===> same_value/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> built_in/same/input.scss +@use "sass:meta"; +a {b: meta.get-mixin(load-css, meta) == meta.get-mixin(load-css, meta)} + +<===> built_in/same/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> built_in/different/input.scss +@use "sass:meta"; +a {b: meta.get-mixin(load-css, meta) == meta.get-mixin(apply, meta)} + +<===> built_in/different/output.css +a { + b: false; +} + +<===> +================================================================================ +<===> user_defined/same/input.scss +@use "sass:meta"; +@mixin user-defined() {} +a {b: meta.get-mixin(user-defined) == meta.get-mixin(user-defined)} + +<===> user_defined/same/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> user_defined/different/input.scss +@use "sass:meta"; +@mixin user-defined-1() {} +@mixin user-defined-2() {} +a {b: meta.get-mixin(user-defined-1) == meta.get-mixin(user-defined-2)} + +<===> user_defined/different/output.css +a { + b: false; +} + +<===> +================================================================================ +<===> user_defined/redefined/input.scss +@use "sass:meta"; +@mixin user-defined() {} +$first-reference: meta.get-mixin(user-defined); + +@mixin user-defined() {} +$second-reference: meta.get-mixin(user-defined); +a {b: $first-reference == $second-reference} + +<===> user_defined/redefined/output.css +a { + b: false; +} diff --git a/spec/core_functions/meta/get_mixin/error.hrx b/spec/core_functions/meta/get_mixin/error.hrx new file mode 100644 index 0000000000..765ed6f078 --- /dev/null +++ b/spec/core_functions/meta/get_mixin/error.hrx @@ -0,0 +1,224 @@ +<===> argument/type/name/input.scss +@use "sass:meta"; +a {b: meta.get-mixin(2px)} + +<===> argument/type/name/error +Error: $name: 2px is not a string. + , +2 | a {b: meta.get-mixin(2px)} + | ^^^^^^^^^^^^^^^^^^^ + ' + input.scss 2:7 root stylesheet + +<===> +================================================================================ +<===> argument/type/module/input.scss +@use "sass:meta"; +a {b: meta.get-mixin(c, $module: 1)} + +<===> argument/type/module/error +Error: $module: 1 is not a string. + , +2 | a {b: meta.get-mixin(c, $module: 1)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 2:7 root stylesheet + +<===> +================================================================================ +<===> argument/mixin_ref/input.scss +@use "sass:meta"; +@mixin a() {} + +$a-ref: meta.get-mixin(a); +a {b: meta.get-mixin($a-ref)} + +<===> argument/mixin_ref/error +Error: $name: get-mixin("a") is not a string. + , +5 | a {b: meta.get-mixin($a-ref)} + | ^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 5:7 root stylesheet + +<===> +================================================================================ +<===> argument/too_few/input.scss +@use "sass:meta"; +a {b: meta.get-mixin()} + +<===> argument/too_few/error +Error: Missing argument $name. + ,--> input.scss +2 | a {b: meta.get-mixin()} + | ^^^^^^^^^^^^^^^^ invocation + ' + ,--> sass:meta +1 | @function get-mixin($name, $module: null) { + | =============================== declaration + ' + input.scss 2:7 root stylesheet + +<===> +================================================================================ +<===> argument/too_many/input.scss +@use "sass:meta"; +a {b: meta.inspect(meta.get-mixin(c, true, d, e))} + +<===> argument/too_many/error +Error: Only 2 arguments allowed, but 4 were passed. + ,--> input.scss +2 | a {b: meta.inspect(meta.get-mixin(c, true, d, e))} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + ,--> sass:meta +1 | @function get-mixin($name, $module: null) { + | =============================== declaration + ' + input.scss 2:20 root stylesheet + +<===> +================================================================================ +<===> non_existent/input.scss +@use "sass:meta"; +a {b: meta.get-mixin(does-not-exist)} + +<===> non_existent/error +Error: Mixin not found: does-not-exist + , +2 | a {b: meta.get-mixin(does-not-exist)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 2:7 root stylesheet + +<===> +================================================================================ +<===> through_forward/show/input.scss +@use "sass:meta"; +@use "midstream" as *; +a { + @include meta.apply(meta.get-mixin(d)); +} + +<===> through_forward/show/_midstream.scss +@forward "upstream" show c; + +<===> through_forward/show/_upstream.scss +@mixin d() {a: c} + +<===> through_forward/show/error +Error: Mixin not found: d + , +4 | @include meta.apply(meta.get-mixin(d)); + | ^^^^^^^^^^^^^^^^^ + ' + input.scss 4:23 root stylesheet + +<===> +================================================================================ +<===> through_forward/hide/input.scss +@use "sass:meta"; +@use "midstream" as *; +a { + @include meta.apply(meta.get-mixin(c)); +} + +<===> through_forward/hide/_midstream.scss +@forward "upstream" hide c; + +<===> through_forward/hide/_upstream.scss +@mixin c() {a: c} + +<===> through_forward/hide/error +Error: Mixin not found: c + , +4 | @include meta.apply(meta.get-mixin(c)); + | ^^^^^^^^^^^^^^^^^ + ' + input.scss 4:23 root stylesheet + +<===> +================================================================================ +<===> conflict/input.scss +@use "sass:meta"; +@use "other1" as *; +@use "other2" as *; + +a {b: meta.get-mixin(member)} + +<===> conflict/other1.scss +@mixin member() {a: other1} + +<===> conflict/other2.scss +@mixin member() {a: other2} + +<===> conflict/error +Error: This mixin is available from multiple global modules. + , +2 | @use "other1" as *; + | ================== includes mixin +3 | @use "other2" as *; + | ================== includes mixin +... | +5 | a {b: meta.get-mixin(member)} + | ^^^^^^^^^^^^^^^^^^^^^^ mixin use + ' + input.scss 5:7 root stylesheet + +<===> +================================================================================ +<===> module/undefined/input.scss +@use "sass:meta"; +@use "sass:color"; +a {b: meta.get-mixin("c", $module: "color")} + +<===> module/undefined/error +Error: Mixin not found: "c" + , +3 | a {b: meta.get-mixin("c", $module: "color")} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 3:7 root stylesheet + +<===> +================================================================================ +<===> module/non_existent/input.scss +@use "sass:meta"; +a {b: meta.get-mixin("c", $module: "d")} + +<===> module/non_existent/error +Error: There is no module with the namespace "d". + , +2 | a {b: meta.get-mixin("c", $module: "d")} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 2:7 root stylesheet + +<===> +================================================================================ +<===> module/built_in_but_not_loaded/input.scss +@use "sass:meta"; +a {b: meta.get-mixin("red", $module: "color")} + +<===> module/built_in_but_not_loaded/error +Error: There is no module with the namespace "color". + , +2 | a {b: meta.get-mixin("red", $module: "color")} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 2:7 root stylesheet + +<===> +================================================================================ +<===> module/dash_sensitive/input.scss +@use "sass:meta"; +@use "sass:color" as a-b; +c {d: meta.get-mixin("c", $module: "a_b")} + +<===> module/dash_sensitive/error +Error: There is no module with the namespace "a_b". + , +3 | c {d: meta.get-mixin("c", $module: "a_b")} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 3:7 root stylesheet diff --git a/spec/core_functions/meta/get_mixin/options.yml b/spec/core_functions/meta/get_mixin/options.yml new file mode 100644 index 0000000000..3f54c5effb --- /dev/null +++ b/spec/core_functions/meta/get_mixin/options.yml @@ -0,0 +1,3 @@ +--- +:todo: +- sass/libsass#2807 diff --git a/spec/core_functions/meta/get_mixin/same_module.hrx b/spec/core_functions/meta/get_mixin/same_module.hrx new file mode 100644 index 0000000000..288396a841 --- /dev/null +++ b/spec/core_functions/meta/get_mixin/same_module.hrx @@ -0,0 +1,71 @@ +<===> user_defined/input.scss +@use "sass:meta"; +@mixin add-two($v) {b: $v + 2} +$add-two-mixin: meta.get-mixin(add-two); + +a {@include meta.apply($add-two-mixin, 10)} + +<===> user_defined/output.css +a { + b: 12; +} + +<===> +================================================================================ +<===> redefined/input.scss +@use "sass:meta"; +@mixin add-two($v) {b: $v + 2} +$add-two-mixin: meta.get-mixin(add-two); + +// The mixin returned by `meta.get-mixin()` is locked in place when it's +// called. Redefining the mixin after the fact shouldn't affect the stored +// value. +@mixin add-two($v) {@error "Should not be called"} + +a {@include meta.apply($add-two-mixin, 10)} + +<===> redefined/output.css +a { + b: 12; +} + +<===> +================================================================================ +<===> through_import/input.scss +@use "sass:meta"; +@import "other"; +a {@include meta.apply(meta.get-mixin(add-two), 10)} + +<===> through_import/other.scss +@mixin add-two($v) {b: $v + 2} + +<===> through_import/output.css +a { + b: 12; +} + +<===> +================================================================================ +<===> dash_insensitive/dash_to_underscore/input.scss +@use "sass:meta"; +@mixin add_two($v) {b: $v + 2} + +a {@include meta.apply(meta.get-mixin(add-two), 10)} + +<===> dash_insensitive/dash_to_underscore/output.css +a { + b: 12; +} + +<===> +================================================================================ +<===> dash_insensitive/underscore_to_dash/input.scss +@use "sass:meta"; +@mixin add-two($v) {b: $v + 2} + +a {@include meta.apply(meta.get-mixin(add_two), 10)} + +<===> dash_insensitive/underscore_to_dash/output.css +a { + b: 12; +} diff --git a/spec/core_functions/meta/get_mixin/scope.hrx b/spec/core_functions/meta/get_mixin/scope.hrx new file mode 100644 index 0000000000..253148e845 --- /dev/null +++ b/spec/core_functions/meta/get_mixin/scope.hrx @@ -0,0 +1,90 @@ +<===> stores_local_scope/options.yml +--- +:todo: +- sass/libsass#2830 + +<===> stores_local_scope/input.scss +@use "sass:meta"; +$add-two-mixin: null; + +.scope { + @mixin add-two($v) {b: $v + 2} + + // This mixin reference will still refer to this nested `add-two` mixin + // even when it goes out of scope. + $add-two-mixin: get-mixin(add-two) !global; +} + +a {@include meta.apply($add-two-mixin, 10)} + +<===> stores_local_scope/output.css +a { + b: 12; +} + +<===> +================================================================================ +<===> captures_inner_scope/input.scss +@use "sass:meta"; +@mixin add-two($v) {@error "Should not be called"} +.scope1 { + @mixin add-two($v) {@error "Should not be called"} + .scope2 { + @mixin add-two($v) {@error "Should not be called"} + .scope3 { + @mixin add-two($v) {a: $v + 2} + + // Like a normal mixin call, get-mixin() will always use the + // innermost definition of a mixin. + @include meta.apply(get-mixin(add-two), 10); + } + } +} + +<===> captures_inner_scope/output.css +.scope1 .scope2 .scope3 { + a: 12; +} + +<===> +================================================================================ +<===> scope/mutated_global/input.scss +@use "sass:meta"; +$a: x; + +@mixin a {a: $a} + +$ref: meta.get-mixin("a"); + +$a: y; + +a {@include meta.apply($ref);} + +<===> scope/mutated_global/output.css +a { + a: y; +} + +<===> +================================================================================ +<===> scope/mutated_local/input.scss +@use "sass:meta"; + +a { + $a: x; + + @mixin a { + a: $a; + } + + $ref: meta.get-mixin("a"); + + $a: y; + @include meta.apply($ref); +} + +<===> scope/mutated_local/output.css +a { + a: y; +} + diff --git a/spec/core_functions/meta/inspect/mixin.hrx b/spec/core_functions/meta/inspect/mixin.hrx new file mode 100644 index 0000000000..2a891f049b --- /dev/null +++ b/spec/core_functions/meta/inspect/mixin.hrx @@ -0,0 +1,27 @@ +<===> options.yml +--- +:todo: +- sass/libsass#2807 + +<===> +================================================================================ +<===> user_defined/input.scss +@use "sass:meta"; +@mixin a() {} +a {b: inspect(meta.get-mixin(a))}; + +<===> user_defined/output.css +a { + b: get-mixin("a"); +} + +<===> +================================================================================ +<===> builtin/input.scss +@use "sass:meta"; +a {b: inspect(meta.get-mixin(load-css, meta))}; + +<===> builtin/output.css +a { + b: get-mixin("load-css"); +} diff --git a/spec/core_functions/meta/load_css/error/content.hrx b/spec/core_functions/meta/load_css/error/content.hrx new file mode 100644 index 0000000000..49fda0c865 --- /dev/null +++ b/spec/core_functions/meta/load_css/error/content.hrx @@ -0,0 +1,17 @@ +<===> input.scss +@use "sass:meta"; +@include meta.load-css("other") {}; + +<===> _other.scss + +<===> error +Error: Mixin doesn't accept a content block. + ,--> input.scss +2 | @include meta.load-css("other") {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + ,--> sass:meta +1 | @mixin load-css($url, $with: null) { + | =========================== declaration + ' + input.scss 2:1 root stylesheet diff --git a/spec/core_functions/meta/module_mixins.hrx b/spec/core_functions/meta/module_mixins.hrx new file mode 100644 index 0000000000..edcdac0ec3 --- /dev/null +++ b/spec/core_functions/meta/module_mixins.hrx @@ -0,0 +1,400 @@ +<===> options.yml +--- +:todo: +- sass/libsass#2807 + +<===> _utils.scss +@use "sass:meta"; + +@mixin print-mixin-map($mixins) { + a { + @each $name, $mixin in $mixins { + #{$name}: {@include meta.apply($mixin)}; + } + } +} + +<===> +================================================================================ +<===> empty/input.scss +@use "sass:meta"; +@use "other"; + +a {b: meta.inspect(meta.module-mixins("other"))} + +<===> empty/_other.scss +// This module defines no mixins. + +<===> empty/output.css +a { + b: (); +} + +<===> +================================================================================ +<===> return_type/user_defined/input.scss +@use "sass:meta"; +@use "other"; + +a {b: meta.type-of(meta.module-mixins("other"))} + +<===> return_type/user_defined/_other.scss +// This module defines no mixins. + +<===> return_type/user_defined/output.css +a { + b: map; +} + +<===> +================================================================================ +<===> return_type/builtin/input.scss +@use "sass:meta"; + +a {b: meta.type-of(meta.module-mixins("meta"))} + +<===> return_type/builtin/output.css +a { + b: map; +} + +<===> +================================================================================ +<===> multiple/input.scss +@use "sass:meta"; +@use "core_functions/meta/module_mixins/utils"; +@use "other"; + +@include utils.print-mixin-map(meta.module-mixins("other")); + +<===> multiple/_other.scss +@mixin b() {b: value} +@mixin c() {c: value} +@mixin d() {d: value} + +<===> multiple/output.css +a { + b-b: value; + c-c: value; + d-d: value; +} + +<===> +================================================================================ +<===> dash_sensitive/input.scss +@use "sass:meta"; +@use "core_functions/meta/module_mixins/utils"; +@use "other"; + +@include utils.print-mixin-map(meta.module-mixins("other")); + +<===> dash_sensitive/_other.scss +@mixin b-c() {b-c: value} +@mixin d_e() {d_e: value} + +<===> dash_sensitive/output.css +a { + b-c-b-c: value; + d-e-d_e: value; +} + +<===> +================================================================================ +<===> as/input.scss +@use "sass:meta"; +@use "core_functions/meta/module_mixins/utils"; +@use "other" as b; + +@include utils.print-mixin-map(meta.module-mixins("b")) + +<===> as/_other.scss +@mixin c() {c: value} +@mixin d() {d: value} +@mixin e() {e: value} + +<===> as/output.css +a { + c-c: value; + d-d: value; + e-e: value; +} + +<===> +================================================================================ +<===> through_import/input.scss +@use "sass:meta"; +@use "core_functions/meta/module_mixins/utils"; +@use "used"; + +@include utils.print-mixin-map(meta.module-mixins("used")); + +<===> through_import/_used.scss +@import "imported"; + +<===> through_import/_imported.scss +@mixin b() {b: value} +@mixin c() {c: value} +@mixin d() {d: value} + +<===> through_import/output.css +a { + b-b: value; + c-c: value; + d-d: value; +} + +<===> +================================================================================ +<===> core_module/input.scss +@use "sass:map"; +@use "sass:meta"; + +// We don't want to print every mixin name in this module, since that would +// make this test brittle when new mixins are added. Instead we just test +// that a couple mixins work. + +$mixins: meta.module-mixins("meta"); +a { + load-css-exists: map.has-key($mixins, "load-css"); +} + +<===> core_module/output.css +a { + load-css-exists: true; +} + +<===> +================================================================================ +<===> through_forward/bare/input.scss +@use "sass:meta"; +@use "../../utils"; +@use "used"; + +@include utils.print-mixin-map(meta.module-mixins("used")); + +<===> through_forward/bare/_used.scss +@forward "forwarded"; + +<===> through_forward/bare/_forwarded.scss +@mixin b() {b: value} +@mixin c() {c: value} +@mixin d() {d: value} + +<===> through_forward/bare/output.css +a { + b-b: value; + c-c: value; + d-d: value; +} + +<===> +================================================================================ +<===> through_forward/as/input.scss +@use "sass:meta"; +@use "../../utils"; +@use "used"; + +@include utils.print-mixin-map(meta.module-mixins("used")); + +<===> through_forward/as/_used.scss +@forward "forwarded" as b-*; + +<===> through_forward/as/_forwarded.scss +@mixin c() {c: value} +@mixin d() {d: value} +@mixin e() {e: value} + +<===> through_forward/as/output.css +a { + b-c-c: value; + b-d-d: value; + b-e-e: value; +} + +<===> +================================================================================ +<===> through_forward/show/input.scss +@use "sass:meta"; +@use "../../utils"; +@use "used"; + +@include utils.print-mixin-map(meta.module-mixins("used")); + +<===> through_forward/show/_used.scss +@forward "forwarded" show b, c; + +<===> through_forward/show/_forwarded.scss +@mixin b() {b: value} +@mixin c() {c: value} +@mixin d() {d: value} + +<===> through_forward/show/output.css +a { + b-b: value; + c-c: value; +} + +<===> +================================================================================ +<===> through_forward/hide/input.scss +@use "sass:meta"; +@use "../../utils"; +@use "used"; + +@include utils.print-mixin-map(meta.module-mixins("used")); + +<===> through_forward/hide/_used.scss +@forward "forwarded" hide b, c; + +<===> through_forward/hide/_forwarded.scss +@mixin b() {b: value} +@mixin c() {c: value} +@mixin d() {d: value} + +<===> through_forward/hide/output.css +a { + d-d: value; +} + +<===> +================================================================================ +<===> named/input.scss +@use "sass:meta"; +@use "core_functions/meta/module_mixins/utils"; +@use "other"; + +@include utils.print-mixin-map(meta.module-mixins($module: "other")); + +<===> named/_other.scss +@mixin b() {b: value} +@mixin c() {c: value} +@mixin d() {d: value} + +<===> named/output.css +a { + b-b: value; + c-c: value; + d-d: value; +} + +<===> +================================================================================ +<===> error/type/input.scss +@use "sass:meta"; +$a: meta.module-mixins(1); + +<===> error/type/error +Error: $module: 1 is not a string. + , +2 | $a: meta.module-mixins(1); + | ^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 2:5 root stylesheet + +<===> +================================================================================ +<===> error/too_few_args/input.scss +@use "sass:meta"; +$a: meta.module-mixins(); + +<===> error/too_few_args/error +Error: Missing argument $module. + ,--> input.scss +2 | $a: meta.module-mixins(); + | ^^^^^^^^^^^^^^^^^^^^ invocation + ' + ,--> sass:meta +1 | @function module-mixins($module) { + | ====================== declaration + ' + input.scss 2:5 root stylesheet + +<===> +================================================================================ +<===> error/too_many_args/input.scss +@use "sass:meta"; +$a: meta.module-mixins("meta", "c"); + +<===> error/too_many_args/error +Error: Only 1 argument allowed, but 2 were passed. + ,--> input.scss +2 | $a: meta.module-mixins("meta", "c"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invocation + ' + ,--> sass:meta +1 | @function module-mixins($module) { + | ====================== declaration + ' + input.scss 2:5 root stylesheet + +<===> +================================================================================ +<===> error/missing/input.scss +@use "sass:meta"; +$a: meta.module-mixins("other"); + +<===> error/missing/error +Error: There is no module with namespace "other". + , +2 | $a: meta.module-mixins("other"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 2:5 root stylesheet + +<===> +================================================================================ +<===> error/dash_sensitive/input.scss +@use "sass:meta"; +@use "other-module"; + +$a: meta.module-mixins("other_module"); + +<===> error/dash_sensitive/_other-module.scss +// This module defines no mixins. + +<===> error/dash_sensitive/error +Error: There is no module with namespace "other_module". + , +4 | $a: meta.module-mixins("other_module"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 4:5 root stylesheet + +<===> +================================================================================ +<===> error/global/input.scss +@use "sass:meta"; +@use "other" as *; + +$a: meta.module-mixins("other"); + +<===> error/global/_other.scss +// This module defines no mixins. + +<===> error/global/error +Error: There is no module with namespace "other". + , +4 | $a: meta.module-mixins("other"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 4:5 root stylesheet + +<===> +================================================================================ +<===> error/before_load/input.scss +@use "sass:meta"; + +$a: meta.module-mixins("other"); + +@use "other"; + +<===> error/before_load/_other.scss +// This module defines no mixins. + +<===> error/before_load/error +Error: There is no module with namespace "other". + , +3 | $a: meta.module-mixins("other"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 3:5 root stylesheet diff --git a/spec/core_functions/meta/type_of.hrx b/spec/core_functions/meta/type_of.hrx index 45b5379a64..6355989e83 100644 --- a/spec/core_functions/meta/type_of.hrx +++ b/spec/core_functions/meta/type_of.hrx @@ -177,6 +177,36 @@ a { b: calculation; } +<===> +================================================================================ +<===> mixin/options.yml +--- +:todo: +- sass/libsass#2807 + +<===> +================================================================================ +<===> mixin/user_defined/input.scss +@use "sass:meta"; +@mixin a() {} +a {b: type-of(meta.get-mixin(a))} + +<===> mixin/user_defined/output.css +a { + b: mixin; +} + +<===> +================================================================================ +<===> mixin/builtin/input.scss +@use "sass:meta"; +a {b: type-of(meta.get-mixin(load-css, meta))} + +<===> mixin/builtin/output.css +a { + b: mixin; +} + <===> ================================================================================ <===> named/input.scss diff --git a/spec/libsass-closed-issues/issue_1079.hrx b/spec/libsass-closed-issues/issue_1079.hrx index 8946c1e177..3a6ba16ba3 100644 --- a/spec/libsass-closed-issues/issue_1079.hrx +++ b/spec/libsass-closed-issues/issue_1079.hrx @@ -2,9 +2,13 @@ #{hdr(2,5)} { color: #08c; } <===> error Error: expected selector. - , + ,--> input.scss 1 | #{hdr(2,5)} { color: #08c; } - | ^^^^^^^^ + | ^^^^^^^^ + ' + , +1 | hdr(2, 5) + | = error in interpolated output ' input.scss 1:3 root stylesheet diff --git a/spec/values/mixins.hrx b/spec/values/mixins.hrx new file mode 100644 index 0000000000..fdc6029d8e --- /dev/null +++ b/spec/values/mixins.hrx @@ -0,0 +1,84 @@ +<===> options.yml +--- +:todo: +- sass/libsass#2807 + +<===> +================================================================================ +<===> error/addition/input.scss +@use "sass:meta"; +@mixin a() {} +@mixin b() {} +a {b: meta.get-mixin(a) + meta.get-mixin(b)} + +<===> error/addition/error +Error: get-mixin("a") isn't a valid CSS value. + , +4 | a {b: meta.get-mixin(a) + meta.get-mixin(b)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 4:7 root stylesheet + +<===> +================================================================================ +<===> error/subtraction/input.scss +@use "sass:meta"; +@mixin a() {} +@mixin b() {} +a {b: meta.get-mixin(a) - meta.get-mixin(b)} + +<===> error/subtraction/error +Error: get-mixin("a") isn't a valid CSS value. + , +4 | a {b: meta.get-mixin(a) - meta.get-mixin(b)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 4:7 root stylesheet + +<===> +================================================================================ +<===> error/multiplication/input.scss +@use "sass:meta"; +@mixin a() {} +@mixin b() {} +a {b: meta.get-mixin(a) * meta.get-mixin(b)} + +<===> error/multiplication/error +Error: Undefined operation "get-mixin("a") * get-mixin("b")". + , +4 | a {b: meta.get-mixin(a) * meta.get-mixin(b)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 4:7 root stylesheet + +<===> +================================================================================ +<===> error/division/input.scss +@use "sass:meta"; +@mixin a() {} +@mixin b() {} +a {b: meta.get-mixin(a) / meta.get-mixin(b)} + +<===> error/division/error +Error: get-mixin("a") isn't a valid CSS value. + , +4 | a {b: meta.get-mixin(a) / meta.get-mixin(b)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 4:7 root stylesheet + +<===> +================================================================================ +<===> error/modulo/input.scss +@use "sass:meta"; +@mixin a() {} +@mixin b() {} +a {b: meta.get-mixin(a) % meta.get-mixin(b)} + +<===> error/modulo/error +Error: Undefined operation "get-mixin("a") % get-mixin("b")". + , +4 | a {b: meta.get-mixin(a) % meta.get-mixin(b)} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 4:7 root stylesheet