diff --git a/kiss/build-scripts/common-args.hxml b/kiss/build-scripts/common-args.hxml index ab28f360..447e77ad 100644 --- a/kiss/build-scripts/common-args.hxml +++ b/kiss/build-scripts/common-args.hxml @@ -4,4 +4,5 @@ -lib tink_json -cp kiss/src -cp cloner/src --D analyzer-optimize \ No newline at end of file +-D analyzer-optimize +--macro kiss.Kiss.setup() \ No newline at end of file diff --git a/kiss/src/kiss/Kiss.hx b/kiss/src/kiss/Kiss.hx index 7dcd7c71..67df882b 100644 --- a/kiss/src/kiss/Kiss.hx +++ b/kiss/src/kiss/Kiss.hx @@ -161,6 +161,23 @@ class Kiss { #end } + /** + * Initializer macro: suppress some compiler warnings that Kiss code commonly generates + * Source: https://try.haxe.org/#10F18962 by @kLabz + */ + public static macro function setup() { + haxe.macro.Context.onAfterTyping(function(_) { + haxe.macro.Context.filterMessages(function(msg) { + return switch (msg) { + case Warning("This case is unused", _): false; + case _: true; + }; + }); + }); + + return macro {}; + } + /** Build macro: add fields to a class from a corresponding .kiss file **/ diff --git a/projects/kiss-vscode/config/build.hxml b/projects/kiss-vscode/config/build.hxml index 0273ca02..2b069d92 100644 --- a/projects/kiss-vscode/config/build.hxml +++ b/projects/kiss-vscode/config/build.hxml @@ -5,5 +5,6 @@ args.hxml -lib kiss-vscode -lib kiss-tools -lib re-flex +--macro kiss.Kiss.setup() KissConfig -js config.js \ No newline at end of file diff --git a/projects/kiss-vscode/src/Util.kiss b/projects/kiss-vscode/src/Util.kiss index 2100acec..c25bc790 100644 --- a/projects/kiss-vscode/src/Util.kiss +++ b/projects/kiss-vscode/src/Util.kiss @@ -134,20 +134,19 @@ null))))) (function :Void showCompileError [errorMessage] - (ifLet [errorMessage (.join (filter (errorMessage.split "\n") ->[:String l] (= -1 (l.indexOf "This case is unused"))) "\n") - compileErrors (R.distinctMatches - (R.group - (R.namedGroup "file" - (R.repeat (R.oneOf R.anyLetter R.anyDigit (R.escape "/")) 1) // filename - (R.escape ".kiss:") - (R.repeat R.anyDigit 1) // line - (R.escape ":") - (R.optional - (R.group - (R.repeat R.anyDigit 1) // column - (R.escape ":")))) - (R.repeat R.anyChar 1)) - errorMessage)] + (ifLet [compileErrors (R.distinctMatches + (R.group + (R.namedGroup "file" + (R.repeat (R.oneOf R.anyLetter R.anyDigit (R.escape "/")) 1) // filename + (R.escape ".kiss:") + (R.repeat R.anyDigit 1) // line + (R.escape ":") + (R.optional + (R.group + (R.repeat R.anyDigit 1) // column + (R.escape ":")))) + (R.repeat R.anyChar 1)) + errorMessage)] { (Vscode.window.showErrorMessage errorMessage) (awaitLet [chosen (quickPickMap (for match compileErrors =>match.match match))] diff --git a/test.sh b/test.sh index 9d558428..a303b761 100755 --- a/test.sh +++ b/test.sh @@ -15,12 +15,12 @@ fi # Test projects with test-project.sh if [ ! -z "$KISS_PROJECT" ] then - ./test-project.sh 2>&1 | grep -v "This case is unused" + ./test-project.sh # Test Kiss with utest cases in kiss/src/test/cases else if [ ! -z "$2" ]; then - haxe -D cases=$2 kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml kiss/build-scripts/$KISS_TARGET/test.hxml 2>&1 | grep -v "This case is unused" + haxe -D cases=$2 kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml kiss/build-scripts/$KISS_TARGET/test.hxml else - haxe kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml kiss/build-scripts/$KISS_TARGET/test.hxml 2>&1 | grep -v "This case is unused" + haxe kiss/build-scripts/common-args.hxml kiss/build-scripts/common-test-args.hxml kiss/build-scripts/$KISS_TARGET/test.hxml fi fi