diff --git a/docs/api/SUMMARY.md b/docs/api/SUMMARY.md index c33e083fc..e771a5fe4 100644 --- a/docs/api/SUMMARY.md +++ b/docs/api/SUMMARY.md @@ -46,7 +46,7 @@ search: - [Nothing](safeds/lang/Nothing.md) - [Number](safeds/lang/Number.md) - [Pure](safeds/lang/Pure.md) - - [PythonCall](safeds/lang/PythonCall.md) + - [PythonMacro](safeds/lang/PythonMacro.md) - [PythonModule](safeds/lang/PythonModule.md) - [PythonName](safeds/lang/PythonName.md) - [Repeatable](safeds/lang/Repeatable.md) diff --git a/docs/api/safeds/lang/Any.md b/docs/api/safeds/lang/Any.md index b33d2eddb..06926f70a 100644 --- a/docs/api/safeds/lang/Any.md +++ b/docs/api/safeds/lang/Any.md @@ -13,7 +13,7 @@ The common superclass of all classes. class Any { /** - * Returns a string representation of the object. + * Return a string representation of the object. * * @example * pipeline example { @@ -21,20 +21,20 @@ The common superclass of all classes. * } */ @Pure - @PythonCall("str($this)") - fun toString() -> s: String + @PythonMacro("str($this)") + fun toString() -> string: String } ``` ## `#!sds fun` toString {#safeds.lang.Any.toString data-toc-label='toString'} -Returns a string representation of the object. +Return a string representation of the object. **Results:** | Name | Type | Description | |------|------|-------------| -| `s` | [`String`][safeds.lang.String] | - | +| `string` | [`String`][safeds.lang.String] | - | **Examples:** @@ -48,6 +48,6 @@ pipeline example { ```sds linenums="16" @Pure - @PythonCall("str($this)") - fun toString() -> s: String + @PythonMacro("str($this)") + fun toString() -> string: String ``` diff --git a/docs/api/safeds/lang/Float.md b/docs/api/safeds/lang/Float.md index 3d9a8aac9..4e9141528 100644 --- a/docs/api/safeds/lang/Float.md +++ b/docs/api/safeds/lang/Float.md @@ -21,8 +21,9 @@ pipeline example { ```sds linenums="77" class Float sub Number { + /** - * Converts this floating-point number to an integer by truncating the fractional part. + * Convert this floating-point number to an integer by truncating the fractional part. * * @example * pipeline example { @@ -30,20 +31,20 @@ pipeline example { * } */ @Pure - @PythonCall("int($this)") - fun toInt() -> i: Int + @PythonMacro("int($this)") + fun toInt() -> int: Int } ``` ## `#!sds fun` toInt {#safeds.lang.Float.toInt data-toc-label='toInt'} -Converts this floating-point number to an integer by truncating the fractional part. +Convert this floating-point number to an integer by truncating the fractional part. **Results:** | Name | Type | Description | |------|------|-------------| -| `i` | [`Int`][safeds.lang.Int] | - | +| `int` | [`Int`][safeds.lang.Int] | - | **Examples:** @@ -55,8 +56,8 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="86" + ```sds linenums="87" @Pure - @PythonCall("int($this)") - fun toInt() -> i: Int + @PythonMacro("int($this)") + fun toInt() -> int: Int ``` diff --git a/docs/api/safeds/lang/Impure.md b/docs/api/safeds/lang/Impure.md index 44582cb10..8ad880d66 100644 --- a/docs/api/safeds/lang/Impure.md +++ b/docs/api/safeds/lang/Impure.md @@ -1,6 +1,6 @@ # :test_tube:{ title="Experimental" } `#!sds annotation` Impure {#safeds.lang.Impure data-toc-label='Impure'} -Indicates that the function has side effects and/or does not always return the same results given the same arguments. +The function has side effects and/or does not always return the same results given the same arguments. **Parameters:** @@ -14,6 +14,6 @@ Indicates that the function has side effects and/or does not always return the s ??? quote "Stub code in `purity.sdsstub`" - ```sds linenums="22" + ```sds linenums="23" annotation Impure(allReasons: List) ``` diff --git a/docs/api/safeds/lang/ImpurityReason.md b/docs/api/safeds/lang/ImpurityReason.md index 2b20d1061..557f91e57 100644 --- a/docs/api/safeds/lang/ImpurityReason.md +++ b/docs/api/safeds/lang/ImpurityReason.md @@ -4,7 +4,7 @@ A reason why a function is impure. ??? quote "Stub code in `purity.sdsstub`" - ```sds linenums="27" + ```sds linenums="28" enum ImpurityReason { /** diff --git a/docs/api/safeds/lang/Int.md b/docs/api/safeds/lang/Int.md index f7f59cfa1..89952b04a 100644 --- a/docs/api/safeds/lang/Int.md +++ b/docs/api/safeds/lang/Int.md @@ -23,7 +23,7 @@ pipeline example { class Int sub Number { /** - * Converts this integer to a floating-point number. + * Convert this integer to a floating-point number. * * @example * pipeline example { @@ -31,20 +31,20 @@ pipeline example { * } */ @Pure - @PythonCall("float($this)") - fun toFloat() -> f: Float + @PythonMacro("float($this)") + fun toFloat() -> float: Float } ``` ## `#!sds fun` toFloat {#safeds.lang.Int.toFloat data-toc-label='toFloat'} -Converts this integer to a floating-point number. +Convert this integer to a floating-point number. **Results:** | Name | Type | Description | |------|------|-------------| -| `f` | [`Float`][safeds.lang.Float] | - | +| `float` | [`Float`][safeds.lang.Float] | - | **Examples:** @@ -58,6 +58,6 @@ pipeline example { ```sds linenums="64" @Pure - @PythonCall("float($this)") - fun toFloat() -> f: Float + @PythonMacro("float($this)") + fun toFloat() -> float: Float ``` diff --git a/docs/api/safeds/lang/List.md b/docs/api/safeds/lang/List.md index 19e45396f..685f46b07 100644 --- a/docs/api/safeds/lang/List.md +++ b/docs/api/safeds/lang/List.md @@ -23,11 +23,43 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="99" + ```sds linenums="100" class List { /** - * Returns the number of elements in the list. + * Join the elements of the list into a string using the separator. + * + * @example + * pipeline example { + * val string = [1, 2, 3].join(); // "1, 2, 3" + * } + * + * @example + * pipeline example { + * val string = [1, 2, 3].join("-"); // "1-2-3" + * } + */ + @Pure + @PythonMacro("$separator.join($this)") + fun join(separator: String = ", ") -> string: String + + /** + * Return the slice of the list starting at the start index up to but excluding the end index. + * + * @param start The start index (inclusive). + * @param end The end index (exclusive). Negative indices count from the end of the list. + * + * @example + * pipeline example { + * val slice = [1, 2, 3].slice(1, 3); // [2, 3] + * } + */ + @Pure + @PythonMacro("$this[$start:$end]") + fun slice(start: Int = 0, end: Int = this.size()) -> slice: List + + /** + * Return the number of elements in the list. * * @example * pipeline example { @@ -35,14 +67,51 @@ pipeline example { * } */ @Pure - @PythonCall("len($this)") + @PythonMacro("len($this)") fun size() -> size: Int } ``` +## `#!sds fun` join {#safeds.lang.List.join data-toc-label='join'} + +Join the elements of the list into a string using the separator. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `separator` | [`String`][safeds.lang.String] | - | `#!sds ", "` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `string` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val string = [1, 2, 3].join(); // "1, 2, 3" +} +``` +```sds hl_lines="2" +pipeline example { + val string = [1, 2, 3].join("-"); // "1-2-3" +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="115" + @Pure + @PythonMacro("$separator.join($this)") + fun join(separator: String = ", ") -> string: String + ``` + ## `#!sds fun` size {#safeds.lang.List.size data-toc-label='size'} -Returns the number of elements in the list. +Return the number of elements in the list. **Results:** @@ -60,8 +129,41 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="109" + ```sds linenums="142" @Pure - @PythonCall("len($this)") + @PythonMacro("len($this)") fun size() -> size: Int ``` + +## `#!sds fun` slice {#safeds.lang.List.slice data-toc-label='slice'} + +Return the slice of the list starting at the start index up to but excluding the end index. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `start` | [`Int`][safeds.lang.Int] | The start index (inclusive). | `#!sds 0` | +| `end` | [`Int`][safeds.lang.Int] | The end index (exclusive). Negative indices count from the end of the list. | `#!sds this.size()` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `slice` | [`List`][safeds.lang.List] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val slice = [1, 2, 3].slice(1, 3); // [2, 3] +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="130" + @Pure + @PythonMacro("$this[$start:$end]") + fun slice(start: Int = 0, end: Int = this.size()) -> slice: List + ``` diff --git a/docs/api/safeds/lang/Map.md b/docs/api/safeds/lang/Map.md index 499794958..1b99d7af1 100644 --- a/docs/api/safeds/lang/Map.md +++ b/docs/api/safeds/lang/Map.md @@ -28,11 +28,11 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="126" + ```sds linenums="159" class Map { /** - * Returns the number of entries in the map. + * Return the number of entries in the map. * * @example * pipeline example { @@ -45,11 +45,11 @@ pipeline example { * } */ @Pure - @PythonCall("len($this)") + @PythonMacro("len($this)") fun size() -> size: Int /** - * Returns the keys of the map. + * Return the keys of the map. * * @example * pipeline example { @@ -62,11 +62,11 @@ pipeline example { * } */ @Pure - @PythonCall("list($this.keys())") + @PythonMacro("list($this.keys())") fun keys() -> keys: List /** - * Returns the values of the map. + * Return the values of the map. * * @example * pipeline example { @@ -79,14 +79,14 @@ pipeline example { * } */ @Pure - @PythonCall("list($this.values())") + @PythonMacro("list($this.values())") fun values() -> values: List } ``` ## `#!sds fun` keys {#safeds.lang.Map.keys data-toc-label='keys'} -Returns the keys of the map. +Return the keys of the map. **Results:** @@ -109,15 +109,15 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="158" + ```sds linenums="191" @Pure - @PythonCall("list($this.keys())") + @PythonMacro("list($this.keys())") fun keys() -> keys: List ``` ## `#!sds fun` size {#safeds.lang.Map.size data-toc-label='size'} -Returns the number of entries in the map. +Return the number of entries in the map. **Results:** @@ -140,15 +140,15 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="141" + ```sds linenums="174" @Pure - @PythonCall("len($this)") + @PythonMacro("len($this)") fun size() -> size: Int ``` ## `#!sds fun` values {#safeds.lang.Map.values data-toc-label='values'} -Returns the values of the map. +Return the values of the map. **Results:** @@ -171,8 +171,8 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="175" + ```sds linenums="208" @Pure - @PythonCall("list($this.values())") + @PythonMacro("list($this.values())") fun values() -> values: List ``` diff --git a/docs/api/safeds/lang/Pure.md b/docs/api/safeds/lang/Pure.md index b8b895a14..93e5ae1fe 100644 --- a/docs/api/safeds/lang/Pure.md +++ b/docs/api/safeds/lang/Pure.md @@ -1,6 +1,6 @@ # :test_tube:{ title="Experimental" } `#!sds annotation` Pure {#safeds.lang.Pure data-toc-label='Pure'} -Indicates that the function has no side effects and always returns the same results given the same arguments. +The function has no side effects and always returns the same results given the same arguments. Calls to such a function may be eliminated, if its results are not used. Moreover, the function can be memoized, i.e. we can remember its results for a set of arguments. Finally, a pure function can be called at any time, allowing diff --git a/docs/api/safeds/lang/PythonCall.md b/docs/api/safeds/lang/PythonMacro.md similarity index 54% rename from docs/api/safeds/lang/PythonCall.md rename to docs/api/safeds/lang/PythonMacro.md index d8d774c4e..77b6339cf 100644 --- a/docs/api/safeds/lang/PythonCall.md +++ b/docs/api/safeds/lang/PythonMacro.md @@ -1,7 +1,6 @@ -# :test_tube:{ title="Experimental" } `#!sds annotation` PythonCall {#safeds.lang.PythonCall data-toc-label='PythonCall'} +# :test_tube:{ title="Experimental" } `#!sds annotation` PythonMacro {#safeds.lang.PythonMacro data-toc-label='PythonMacro'} -The specification of a corresponding function call in Python. By default, the function is called as specified in the -stubs. +The specification of the corresponding Python code. By default, the function is called as specified in the stubs. The specification can contain template expressions, which are replaced by the corresponding arguments of the function call. `$this` is replaced by the receiver of the call. `$param` is replaced by the value of the parameter called @@ -11,7 +10,7 @@ call. `$this` is replaced by the receiver of the call. `$param` is replaced by t | Name | Type | Description | Default | |------|------|-------------|---------| -| `callSpecification` | [`String`][safeds.lang.String] | - | - | +| `template` | [`String`][safeds.lang.String] | - | - | **Targets:** @@ -19,8 +18,8 @@ call. `$this` is replaced by the receiver of the call. `$param` is replaced by t ??? quote "Stub code in `codeGeneration.sdsstub`" - ```sds linenums="13" - annotation PythonCall( - callSpecification: String + ```sds linenums="12" + annotation PythonMacro( + template: String ) ``` diff --git a/docs/api/safeds/lang/PythonModule.md b/docs/api/safeds/lang/PythonModule.md index bb2753bd9..a96abeac5 100644 --- a/docs/api/safeds/lang/PythonModule.md +++ b/docs/api/safeds/lang/PythonModule.md @@ -15,7 +15,7 @@ stubs. ??? quote "Stub code in `codeGeneration.sdsstub`" - ```sds linenums="22" + ```sds linenums="21" annotation PythonModule( qualifiedName: String ) diff --git a/docs/api/safeds/lang/PythonName.md b/docs/api/safeds/lang/PythonName.md index f961db7b0..a280ffee6 100644 --- a/docs/api/safeds/lang/PythonName.md +++ b/docs/api/safeds/lang/PythonName.md @@ -21,7 +21,7 @@ The name of the corresponding API element in Python. By default, this is the nam ??? quote "Stub code in `codeGeneration.sdsstub`" - ```sds linenums="39" + ```sds linenums="38" annotation PythonName( name: String ) diff --git a/docs/api/safeds/lang/String.md b/docs/api/safeds/lang/String.md index 5d9143388..48633fa79 100644 --- a/docs/api/safeds/lang/String.md +++ b/docs/api/safeds/lang/String.md @@ -17,11 +17,228 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="188" + ```sds linenums="221" class String { /** - * Parses the string to a floating-point number. + * Return the number of characters in the string. + * + * @example + * pipeline example { + * val length = "Hello, world!".length(); // 13 + * } + */ + @Pure + @PythonMacro("len($this)") + fun length() -> length: Int + + /** + * Check if the string contains the substring. + * + * @example + * pipeline example { + * val contains = "Hello, world!".contains("world!"); // true + * } + */ + @Pure + @PythonMacro("$substring in $this") + fun contains(substring: String) -> contains: Boolean + + /** + * Check if the string ends with the suffix. + * + * @example + * pipeline example { + * val endsWith = "Hello, world!".endsWith("world!"); // true + * } + */ + @Pure + @PythonMacro("$this.endswith($suffix)") + fun endsWith(suffix: String) -> endsWith: Boolean + + /** + * Check if the string starts with the prefix. + * + * @example + * pipeline example { + * val startsWith = "Hello, world!".startsWith("Hello"); // true + * } + */ + @Pure + @PythonMacro("$this.startswith($prefix)") + fun startsWith(prefix: String) -> startsWith: Boolean + + /** + * Return the substring of the string starting at the start index up to but excluding the end index. + * + * @param start The start index (inclusive). + * @param end The end index (exclusive). + * + * @example + * pipeline example { + * val substring = "Hello, world!".substring(7, 12); // "world" + * } + */ + @Pure + @PythonMacro("$this[$start:$end]") + fun substring(start: Int = 0, end: Int = this.length()) -> substring: String + + /** + * Return the index of the first occurrence of the substring in the string or -1 if the substring is not found. + * + * @example + * pipeline example { + * val index = "Hello, world!".indexOf("o"); // 4 + * } + */ + @Pure + @PythonMacro("$this.find($substring)") + fun indexOf(substring: String) -> index: Int + + /** + * Return the index of the last occurrence of the substring in the string or -1 if the substring is not found. + * + * @example + * pipeline example { + * val index = "Hello, world!".lastIndexOf("o"); // 8 + * } + */ + @Pure + @PythonMacro("$this.rfind($substring)") + fun lastIndexOf(substring: String) -> index: Int + + /** + * Replace all occurrences of the old substring with the new substring. + * + * @example + * pipeline example { + * val replacedString = "Hello, world!".replace("world", "Safe-DS"); // "Hello, Safe-DS!" + * } + */ + @Pure + @PythonMacro("$this.replace($old, $new)") + fun replace(old: String, new: String) -> replacedString: String + + /** + * Repeat the string n times. + * + * @example + * pipeline example { + * val repeatedString = "Ha".repeat(3); // "HaHaHa" + * } + */ + @Pure + @PythonMacro("$this * $n") + fun repeat(n: Int) -> repeatedString: String + + /** + * Split the string into parts using the separator. + * + * @example + * pipeline example { + * val parts = "a,b,c".split(","); // ["a", "b", "c"] + * } + */ + @Pure + @PythonMacro("$this.split($separator)") + fun split(separator: String) -> parts: List + + /** + * Trim leading and trailing whitespace from the string. + * + * @example + * pipeline example { + * val trimmed = " Hello, world! ".trim(); // "Hello, world!" + * } + */ + @Pure + @PythonMacro("$this.strip()") + fun trim() -> trimmed: String + + /** + * Trim leading whitespace from the string. + * + * @example + * pipeline example { + * val trimmed = " Hello, world! ".trimStart(); // "Hello, world! " + * } + */ + @Pure + @PythonMacro("$this.lstrip()") + fun trimStart() -> trimmed: String + + /** + * Trim trailing whitespace from the string. + * + * @example + * pipeline example { + * val trimmed = " Hello, world! ".trimEnd(); // " Hello, world!" + * } + */ + @Pure + @PythonMacro("$this.rstrip()") + fun trimEnd() -> trimmed: String + + /** + * Normalize the casing of a string to make it suitable for case-insensitive matching. This is essentially a more + * aggressive form of lowercasing. For example, the German lowercase letter "ß" gets converted to "ss". + * + * Casefolding is described in section 3.13 of the [Unicode Standard](https://www.unicode.org/versions/latest/). + * + * @example + * pipeline example { + * val casefolded = "Hello, world!".toCasefolded(); // "hello, world!" + * } + * + * @example + * pipeline example { + * val casefolded = "Poststraße".toCasefolded(); // "poststrasse" + * } + */ + @Pure + @PythonMacro("$this.casefold()") + fun toCasefolded() -> casefolded: String + + /** + * Convert the string to lowercase. Prefer {@link String.toCasefolded} for case-insensitive matching. + * + * Lowercasing is described in section 3.13 of the [Unicode Standard](https://www.unicode.org/versions/latest/). + * + * @example + * pipeline example { + * val lowercase = "Hello, world!".toLowercase(); // "hello, world!" + * } + * + * @example + * pipeline example { + * val lowercase = "Poststraße".toLowercase(); // "poststraße" + * } + */ + @Pure + @PythonMacro("$this.lower()") + fun toLowercase() -> lowercase: String + + /** + * Convert the string to uppercase. Prefer {@link String.toCasefolded} for case-insensitive matching. + * + * Uppercasing is described in section 3.13 of the [Unicode Standard](https://www.unicode.org/versions/latest/). + * + * @example + * pipeline example { + * val uppercase = "Hello, world!".toUppercase(); // "HELLO, WORLD!" + * } + * + * @example + * pipeline example { + * val uppercase = "Poststraße".toUppercase(); // "POSTSTRASSE" + * } + */ + @Pure + @PythonMacro("$this.upper()") + fun toUppercase() -> uppercase: String + + /** + * Parse the string to a floating-point number. * * @example * pipeline example { @@ -29,11 +246,11 @@ pipeline example { * } */ @Pure - @PythonCall("float($this)") - fun toFloat() -> f: Float + @PythonMacro("float($this)") + fun toFloat() -> float: Float /** - * Parses the string to an integer. + * Parse the string to an integer. * * @param base The base of the integer. * @@ -48,20 +265,370 @@ pipeline example { * } */ @Pure - @PythonCall("int($this, $base)") - fun toInt(base: Int = 10) -> i: Int + @PythonMacro("int($this, $base)") + fun toInt(base: Int = 10) -> int: Int } ``` +## `#!sds fun` contains {#safeds.lang.String.contains data-toc-label='contains'} + +Check if the string contains the substring. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `substring` | [`String`][safeds.lang.String] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `contains` | [`Boolean`][safeds.lang.Boolean] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val contains = "Hello, world!".contains("world!"); // true +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="243" + @Pure + @PythonMacro("$substring in $this") + fun contains(substring: String) -> contains: Boolean + ``` + +## `#!sds fun` endsWith {#safeds.lang.String.endsWith data-toc-label='endsWith'} + +Check if the string ends with the suffix. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `suffix` | [`String`][safeds.lang.String] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `endsWith` | [`Boolean`][safeds.lang.Boolean] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val endsWith = "Hello, world!".endsWith("world!"); // true +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="255" + @Pure + @PythonMacro("$this.endswith($suffix)") + fun endsWith(suffix: String) -> endsWith: Boolean + ``` + +## `#!sds fun` indexOf {#safeds.lang.String.indexOf data-toc-label='indexOf'} + +Return the index of the first occurrence of the substring in the string or -1 if the substring is not found. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `substring` | [`String`][safeds.lang.String] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `index` | [`Int`][safeds.lang.Int] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val index = "Hello, world!".indexOf("o"); // 4 +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="294" + @Pure + @PythonMacro("$this.find($substring)") + fun indexOf(substring: String) -> index: Int + ``` + +## `#!sds fun` lastIndexOf {#safeds.lang.String.lastIndexOf data-toc-label='lastIndexOf'} + +Return the index of the last occurrence of the substring in the string or -1 if the substring is not found. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `substring` | [`String`][safeds.lang.String] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `index` | [`Int`][safeds.lang.Int] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val index = "Hello, world!".lastIndexOf("o"); // 8 +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="306" + @Pure + @PythonMacro("$this.rfind($substring)") + fun lastIndexOf(substring: String) -> index: Int + ``` + +## `#!sds fun` length {#safeds.lang.String.length data-toc-label='length'} + +Return the number of characters in the string. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `length` | [`Int`][safeds.lang.Int] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val length = "Hello, world!".length(); // 13 +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="231" + @Pure + @PythonMacro("len($this)") + fun length() -> length: Int + ``` + +## `#!sds fun` repeat {#safeds.lang.String.repeat data-toc-label='repeat'} + +Repeat the string n times. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `n` | [`Int`][safeds.lang.Int] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `repeatedString` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val repeatedString = "Ha".repeat(3); // "HaHaHa" +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="330" + @Pure + @PythonMacro("$this * $n") + fun repeat(n: Int) -> repeatedString: String + ``` + +## `#!sds fun` replace {#safeds.lang.String.replace data-toc-label='replace'} + +Replace all occurrences of the old substring with the new substring. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `old` | [`String`][safeds.lang.String] | - | - | +| `new` | [`String`][safeds.lang.String] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `replacedString` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val replacedString = "Hello, world!".replace("world", "Safe-DS"); // "Hello, Safe-DS!" +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="318" + @Pure + @PythonMacro("$this.replace($old, $new)") + fun replace(old: String, new: String) -> replacedString: String + ``` + +## `#!sds fun` split {#safeds.lang.String.split data-toc-label='split'} + +Split the string into parts using the separator. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `separator` | [`String`][safeds.lang.String] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `parts` | [`List`][safeds.lang.List] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val parts = "a,b,c".split(","); // ["a", "b", "c"] +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="342" + @Pure + @PythonMacro("$this.split($separator)") + fun split(separator: String) -> parts: List + ``` + +## `#!sds fun` startsWith {#safeds.lang.String.startsWith data-toc-label='startsWith'} + +Check if the string starts with the prefix. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `prefix` | [`String`][safeds.lang.String] | - | - | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `startsWith` | [`Boolean`][safeds.lang.Boolean] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val startsWith = "Hello, world!".startsWith("Hello"); // true +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="267" + @Pure + @PythonMacro("$this.startswith($prefix)") + fun startsWith(prefix: String) -> startsWith: Boolean + ``` + +## `#!sds fun` substring {#safeds.lang.String.substring data-toc-label='substring'} + +Return the substring of the string starting at the start index up to but excluding the end index. + +**Parameters:** + +| Name | Type | Description | Default | +|------|------|-------------|---------| +| `start` | [`Int`][safeds.lang.Int] | The start index (inclusive). | `#!sds 0` | +| `end` | [`Int`][safeds.lang.Int] | The end index (exclusive). | `#!sds this.length()` | + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `substring` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val substring = "Hello, world!".substring(7, 12); // "world" +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="282" + @Pure + @PythonMacro("$this[$start:$end]") + fun substring(start: Int = 0, end: Int = this.length()) -> substring: String + ``` + +## `#!sds fun` toCasefolded {#safeds.lang.String.toCasefolded data-toc-label='toCasefolded'} + +Normalize the casing of a string to make it suitable for case-insensitive matching. This is essentially a more +aggressive form of lowercasing. For example, the German lowercase letter "ß" gets converted to "ss". + +Casefolding is described in section 3.13 of the [Unicode Standard](https://www.unicode.org/versions/latest/). + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `casefolded` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val casefolded = "Hello, world!".toCasefolded(); // "hello, world!" +} +``` +```sds hl_lines="2" +pipeline example { + val casefolded = "Poststraße".toCasefolded(); // "poststrasse" +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="398" + @Pure + @PythonMacro("$this.casefold()") + fun toCasefolded() -> casefolded: String + ``` + ## `#!sds fun` toFloat {#safeds.lang.String.toFloat data-toc-label='toFloat'} -Parses the string to a floating-point number. +Parse the string to a floating-point number. **Results:** | Name | Type | Description | |------|------|-------------| -| `f` | [`Float`][safeds.lang.Float] | - | +| `float` | [`Float`][safeds.lang.Float] | - | **Examples:** @@ -73,15 +640,15 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="198" + ```sds linenums="448" @Pure - @PythonCall("float($this)") - fun toFloat() -> f: Float + @PythonMacro("float($this)") + fun toFloat() -> float: Float ``` ## `#!sds fun` toInt {#safeds.lang.String.toInt data-toc-label='toInt'} -Parses the string to an integer. +Parse the string to an integer. **Parameters:** @@ -93,7 +660,7 @@ Parses the string to an integer. | Name | Type | Description | |------|------|-------------| -| `i` | [`Int`][safeds.lang.Int] | - | +| `int` | [`Int`][safeds.lang.Int] | - | **Examples:** @@ -110,8 +677,152 @@ pipeline example { ??? quote "Stub code in `coreClasses.sdsstub`" - ```sds linenums="217" + ```sds linenums="467" + @Pure + @PythonMacro("int($this, $base)") + fun toInt(base: Int = 10) -> int: Int + ``` + +## `#!sds fun` toLowercase {#safeds.lang.String.toLowercase data-toc-label='toLowercase'} + +Convert the string to lowercase. Prefer [String.toCasefolded][safeds.lang.String.toCasefolded] for case-insensitive matching. + +Lowercasing is described in section 3.13 of the [Unicode Standard](https://www.unicode.org/versions/latest/). + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `lowercase` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val lowercase = "Hello, world!".toLowercase(); // "hello, world!" +} +``` +```sds hl_lines="2" +pipeline example { + val lowercase = "Poststraße".toLowercase(); // "poststraße" +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="417" + @Pure + @PythonMacro("$this.lower()") + fun toLowercase() -> lowercase: String + ``` + +## `#!sds fun` toUppercase {#safeds.lang.String.toUppercase data-toc-label='toUppercase'} + +Convert the string to uppercase. Prefer [String.toCasefolded][safeds.lang.String.toCasefolded] for case-insensitive matching. + +Uppercasing is described in section 3.13 of the [Unicode Standard](https://www.unicode.org/versions/latest/). + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `uppercase` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val uppercase = "Hello, world!".toUppercase(); // "HELLO, WORLD!" +} +``` +```sds hl_lines="2" +pipeline example { + val uppercase = "Poststraße".toUppercase(); // "POSTSTRASSE" +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="436" + @Pure + @PythonMacro("$this.upper()") + fun toUppercase() -> uppercase: String + ``` + +## `#!sds fun` trim {#safeds.lang.String.trim data-toc-label='trim'} + +Trim leading and trailing whitespace from the string. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `trimmed` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val trimmed = " Hello, world! ".trim(); // "Hello, world!" +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="354" + @Pure + @PythonMacro("$this.strip()") + fun trim() -> trimmed: String + ``` + +## `#!sds fun` trimEnd {#safeds.lang.String.trimEnd data-toc-label='trimEnd'} + +Trim trailing whitespace from the string. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `trimmed` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val trimmed = " Hello, world! ".trimEnd(); // " Hello, world!" +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="378" + @Pure + @PythonMacro("$this.rstrip()") + fun trimEnd() -> trimmed: String + ``` + +## `#!sds fun` trimStart {#safeds.lang.String.trimStart data-toc-label='trimStart'} + +Trim leading whitespace from the string. + +**Results:** + +| Name | Type | Description | +|------|------|-------------| +| `trimmed` | [`String`][safeds.lang.String] | - | + +**Examples:** + +```sds hl_lines="2" +pipeline example { + val trimmed = " Hello, world! ".trimStart(); // "Hello, world! " +} +``` + +??? quote "Stub code in `coreClasses.sdsstub`" + + ```sds linenums="366" @Pure - @PythonCall("int($this, $base)") - fun toInt(base: Int = 10) -> i: Int + @PythonMacro("$this.lstrip()") + fun trimStart() -> trimmed: String ``` diff --git a/docs/src/lexer/safe_ds_lexer/_safe_ds_lexer.py b/docs/src/lexer/safe_ds_lexer/_safe_ds_lexer.py index a8aead665..922f5ccf1 100644 --- a/docs/src/lexer/safe_ds_lexer/_safe_ds_lexer.py +++ b/docs/src/lexer/safe_ds_lexer/_safe_ds_lexer.py @@ -42,6 +42,7 @@ "private", "schema", "static", + "this", "union", "where", "yield", diff --git a/packages/safe-ds-lang/src/language/builtins/safe-ds-annotations.ts b/packages/safe-ds-lang/src/language/builtins/safe-ds-annotations.ts index bc5c0bbf3..dfaf84d43 100644 --- a/packages/safe-ds-lang/src/language/builtins/safe-ds-annotations.ts +++ b/packages/safe-ds-lang/src/language/builtins/safe-ds-annotations.ts @@ -138,8 +138,8 @@ export class SafeDsAnnotations extends SafeDsModuleMembers { // Python ---------------------------------------------------------------------------------------------------------- - getPythonCall(node: SdsFunction | undefined): string | undefined { - const value = this.getParameterValue(node, this.PythonCall, 'callSpecification'); + getPythonMacro(node: SdsFunction | undefined): string | undefined { + const value = this.getParameterValue(node, this.PythonMacro, 'template'); if (value instanceof StringConstant) { return value.value; } else { @@ -147,8 +147,8 @@ export class SafeDsAnnotations extends SafeDsModuleMembers { } } - get PythonCall(): SdsAnnotation | undefined { - return this.getAnnotation(CODE_GENERATION_URI, 'PythonCall'); + get PythonMacro(): SdsAnnotation | undefined { + return this.getAnnotation(CODE_GENERATION_URI, 'PythonMacro'); } // PythonModule ---------------------------------------------------------------------------------------------------- diff --git a/packages/safe-ds-lang/src/language/generation/python/safe-ds-python-generator.ts b/packages/safe-ds-lang/src/language/generation/python/safe-ds-python-generator.ts index 1e863d11a..fd2d8cc04 100644 --- a/packages/safe-ds-lang/src/language/generation/python/safe-ds-python-generator.ts +++ b/packages/safe-ds-lang/src/language/generation/python/safe-ds-python-generator.ts @@ -596,7 +596,7 @@ export class SafeDsPythonGenerator { assignmentStatements.push( expandTracedToNode( savableAssignment, - )`${RUNNER_PACKAGE}.save_placeholder('${savableAssignment.name}', ${savableAssignment.name})`, + )`${RUNNER_PACKAGE}.save_placeholder('${savableAssignment.name}', ${CODEGEN_PREFIX}${savableAssignment.name})`, ); } } @@ -615,7 +615,7 @@ export class SafeDsPythonGenerator { 'name', )(assignee.name)}`; } else if (isSdsPlaceholder(assignee)) { - return traceToNode(assignee)(assignee.name); + return expandTracedToNode(assignee)`${CODEGEN_PREFIX}${assignee.name}`; } else if (isSdsWildcard(assignee)) { return traceToNode(assignee)('_'); } else if (isSdsYield(assignee)) { @@ -740,14 +740,13 @@ export class SafeDsPythonGenerator { // Memoize constructor or function call if (isSdsFunction(callable) || isSdsClass(callable)) { if (isSdsFunction(callable)) { - const pythonCall = this.builtinAnnotations.getPythonCall(callable); + const pythonCall = this.builtinAnnotations.getPythonMacro(callable); if (pythonCall) { let newReceiver: SdsExpression | undefined = undefined; if (isSdsMemberAccess(expression.receiver)) { newReceiver = expression.receiver.receiver; } - const argumentsMap = this.getArgumentsMap(getArguments(expression), frame); - call = this.generatePythonCall(expression, pythonCall, argumentsMap, frame, newReceiver); + call = this.generatePythonMacro(expression, pythonCall, frame, newReceiver); } } if (!call && this.isMemoizableCall(expression) && !frame.disableRunnerIntegration) { @@ -870,7 +869,12 @@ export class SafeDsPythonGenerator { const declaration = expression.target.ref!; const referenceImport = this.createImportDataForReference(expression); frame.addImport(referenceImport); - return traceToNode(expression)(referenceImport?.alias ?? this.getPythonNameOrDefault(declaration)); + + if (isSdsPlaceholder(declaration)) { + return traceToNode(expression)(`${CODEGEN_PREFIX}${declaration.name}`); + } else { + return traceToNode(expression)(referenceImport?.alias ?? this.getPythonNameOrDefault(declaration)); + } } else if (isSdsThis(expression)) { return thisParam; } else if (isSdsTypeCast(expression)) { @@ -889,13 +893,13 @@ export class SafeDsPythonGenerator { )(sortedArgs, (arg) => this.generateArgument(arg, frame), { separator: ', ' })})`; } - private generatePythonCall( + private generatePythonMacro( expression: SdsCall, pythonCall: string, - argumentsMap: Map, frame: GenerationInfoFrame, receiver: SdsExpression | undefined, ): Generated { + const argumentsMap = this.getArgumentsMap(getArguments(expression), frame); let thisParam: Generated | undefined = undefined; if (receiver) { @@ -908,48 +912,18 @@ export class SafeDsPythonGenerator { argumentsMap.set('this', thisParam); } const splitRegex = /(\$[_a-zA-Z][_a-zA-Z0-9]*)/gu; - const splitPythonCallDefinition = pythonCall.split(splitRegex); - const generatedPythonCall = joinTracedToNode(expression)( - splitPythonCallDefinition, + const splitPythonMacroDefinition = pythonCall.split(splitRegex); + return expandToNode`(${joinTracedToNode(expression)( + splitPythonMacroDefinition, (part) => { if (splitRegex.test(part)) { - return argumentsMap.get(part.substring(1))!; + return expandToNode`(${argumentsMap.get(part.substring(1))!})`; } else { return part; } }, { separator: '' }, - )!; - // Non-memoizable calls can be directly generated - if (!this.isMemoizableCall(expression) || frame.disableRunnerIntegration) { - return generatedPythonCall; - } - frame.addImport({ importPath: RUNNER_PACKAGE }); - const callable = this.nodeMapper.callToCallable(expression); - const fullyQualifiedTargetName = this.generateFullyQualifiedFunctionName(expression); - const hiddenParameters = this.getMemoizedCallHiddenParameters(expression, frame); - - if (isSdsFunction(callable) && !isStatic(callable) && isSdsMemberAccess(expression.receiver) && thisParam) { - return expandTracedToNode(expression)` - ${MEMOIZED_STATIC_CALL}( - "${fullyQualifiedTargetName}", - lambda *_ : ${generatedPythonCall}, - [${thisParam}, ${this.generateMemoizedPositionalArgumentList(expression, frame)}], - {${this.generateMemoizedKeywordArgumentList(expression, frame)}}, - [${joinToNode(hiddenParameters, (param) => param, { separator: ', ' })}] - ) - `; - } - - return expandTracedToNode(expression)` - ${MEMOIZED_STATIC_CALL}( - "${fullyQualifiedTargetName}", - lambda *_ : ${generatedPythonCall}, - [${this.generateMemoizedPositionalArgumentList(expression, frame)}], - {${this.generateMemoizedKeywordArgumentList(expression, frame)}}, - [${joinToNode(hiddenParameters, (param) => param, { separator: ', ' })}] - ) - `; + )!})`; } private isMemoizableCall(expression: SdsCall): boolean { @@ -1182,7 +1156,7 @@ export class SafeDsPythonGenerator { private getArgumentsMap(argumentList: SdsArgument[], frame: GenerationInfoFrame): Map { const argumentsMap = new Map(); argumentList.reduce((map, value) => { - map.set(this.nodeMapper.argumentToParameter(value)?.name!, this.generateArgument(value, frame)); + map.set(this.nodeMapper.argumentToParameter(value)?.name!, this.generateArgument(value, frame, false)); return map; }, argumentsMap); return argumentsMap; diff --git a/packages/safe-ds-lang/src/language/validation/builtins/pythonCall.ts b/packages/safe-ds-lang/src/language/validation/builtins/pythonCall.ts index 29d8e4b07..aeb6e7203 100644 --- a/packages/safe-ds-lang/src/language/validation/builtins/pythonCall.ts +++ b/packages/safe-ds-lang/src/language/validation/builtins/pythonCall.ts @@ -1,16 +1,16 @@ import { AstUtils, ValidationAcceptor } from 'langium'; import { isSdsClass, SdsFunction } from '../../generated/ast.js'; import { SafeDsServices } from '../../safe-ds-module.js'; -import { findFirstAnnotationCallOf, getParameters } from '../../helpers/nodeProperties.js'; +import { findFirstAnnotationCallOf, getParameters, isStatic } from '../../helpers/nodeProperties.js'; import { pluralize } from '../../../helpers/strings.js'; -export const CODE_PYTHON_CALL_INVALID_TEMPLATE_EXPRESSION = 'python-call/invalid-template-expression'; +export const CODE_PYTHON_MACRO_INVALID_TEMPLATE_EXPRESSION = 'python-macro/invalid-template-expression'; export const pythonCallMustOnlyContainValidTemplateExpressions = (services: SafeDsServices) => { const builtinAnnotations = services.builtins.Annotations; return (node: SdsFunction, accept: ValidationAcceptor) => { - const pythonCall = builtinAnnotations.getPythonCall(node); + const pythonCall = builtinAnnotations.getPythonMacro(node); if (!pythonCall) { return; } @@ -21,7 +21,7 @@ export const pythonCallMustOnlyContainValidTemplateExpressions = (services: Safe // Compute valid template expressions const validTemplateExpressions = new Set(getParameters(node).map((it) => `\$${it.name}`)); - if (AstUtils.hasContainerOfType(node, isSdsClass)) { + if (AstUtils.hasContainerOfType(node, isSdsClass) && !isStatic(node)) { validTemplateExpressions.add('$this'); } @@ -34,9 +34,9 @@ export const pythonCallMustOnlyContainValidTemplateExpressions = (services: Safe const invalidTemplateExpressionsString = invalidTemplateExpressions.map((it) => `'${it}'`).join(', '); accept('error', `The ${kind} ${invalidTemplateExpressionsString} cannot be interpreted.`, { - node: findFirstAnnotationCallOf(node, builtinAnnotations.PythonCall)!, + node: findFirstAnnotationCallOf(node, builtinAnnotations.PythonMacro)!, property: 'annotation', - code: CODE_PYTHON_CALL_INVALID_TEMPLATE_EXPRESSION, + code: CODE_PYTHON_MACRO_INVALID_TEMPLATE_EXPRESSION, }); } }; diff --git a/packages/safe-ds-lang/src/language/validation/builtins/pythonName.ts b/packages/safe-ds-lang/src/language/validation/builtins/pythonName.ts index 7d285348d..fb6df80a9 100644 --- a/packages/safe-ds-lang/src/language/validation/builtins/pythonName.ts +++ b/packages/safe-ds-lang/src/language/validation/builtins/pythonName.ts @@ -3,14 +3,14 @@ import { SdsDeclaration, SdsFunction } from '../../generated/ast.js'; import { SafeDsServices } from '../../safe-ds-module.js'; import { findFirstAnnotationCallOf, hasAnnotationCallOf } from '../../helpers/nodeProperties.js'; -export const CODE_PYTHON_NAME_MUTUALLY_EXCLUSIVE_WITH_PYTHON_CALL = 'python-name/mutually-exclusive-with-python-call'; +export const CODE_PYTHON_NAME_MUTUALLY_EXCLUSIVE_WITH_PYTHON_MACRO = 'python-name/mutually-exclusive-with-python-macro'; export const CODE_PYTHON_NAME_SAME_AS_SAFE_DS_NAME = 'python-name/same-as-safe-ds-name'; -export const pythonNameMustNotBeSetIfPythonCallIsSet = (services: SafeDsServices) => { +export const pythonNameMustNotBeSetIfPythonMacroIsSet = (services: SafeDsServices) => { const builtinAnnotations = services.builtins.Annotations; return (node: SdsFunction, accept: ValidationAcceptor) => { - if (!hasAnnotationCallOf(node, builtinAnnotations.PythonCall)) { + if (!hasAnnotationCallOf(node, builtinAnnotations.PythonMacro)) { return; } @@ -22,7 +22,7 @@ export const pythonNameMustNotBeSetIfPythonCallIsSet = (services: SafeDsServices accept('error', 'A Python name must not be set if a Python call is set.', { node: firstPythonName, property: 'annotation', - code: CODE_PYTHON_NAME_MUTUALLY_EXCLUSIVE_WITH_PYTHON_CALL, + code: CODE_PYTHON_NAME_MUTUALLY_EXCLUSIVE_WITH_PYTHON_MACRO, }); }; }; diff --git a/packages/safe-ds-lang/src/language/validation/inheritance.ts b/packages/safe-ds-lang/src/language/validation/inheritance.ts index f0cebc238..4fd37a186 100644 --- a/packages/safe-ds-lang/src/language/validation/inheritance.ts +++ b/packages/safe-ds-lang/src/language/validation/inheritance.ts @@ -13,7 +13,7 @@ export const CODE_INHERITANCE_IDENTICAL_TO_OVERRIDDEN_MEMBER = 'inheritance/iden export const CODE_INHERITANCE_INCOMPATIBLE_TO_OVERRIDDEN_MEMBER = 'inheritance/incompatible-to-overridden-member'; export const CODE_INHERITANCE_NOT_A_CLASS = 'inheritance/not-a-class'; export const CODE_INHERITANCE_NULLABLE = 'inheritance/nullable'; -export const CODE_INHERITANCE_PYTHON_CALL = 'inheritance/python-call'; +export const CODE_INHERITANCE_PYTHON_MACRO = 'inheritance/python-macro'; export const CODE_INHERITANCE_PYTHON_NAME = 'inheritance/python-name'; export const classMemberMustMatchOverriddenMemberAndShouldBeNeeded = (services: SafeDsServices) => { @@ -35,10 +35,10 @@ export const classMemberMustMatchOverriddenMemberAndShouldBeNeeded = (services: // Check whether the overriding is legal and needed if ( - // It's an error if the overriding member calls the `@PythonCall` annotation - (isSdsFunction(node) && builtinAnnotations.getPythonCall(node)) || - // It's an error if the overridden member calls the `@PythonCall` annotation - (isSdsFunction(overriddenMember) && builtinAnnotations.getPythonCall(overriddenMember)) || + // It's an error if the overriding member calls the `@PythonMacro` annotation + (isSdsFunction(node) && builtinAnnotations.getPythonMacro(node)) || + // It's an error if the overridden member calls the `@PythonMacro` annotation + (isSdsFunction(overriddenMember) && builtinAnnotations.getPythonMacro(overriddenMember)) || // It's an error if the overriding member has a different Python name than the overridden member (builtinAnnotations.getPythonName(node) ?? node.name) !== (builtinAnnotations.getPythonName(overriddenMember) ?? overriddenMember.name) @@ -217,7 +217,7 @@ export const classMustNotInheritItself = (services: SafeDsServices) => { }; }; -export const overridingAndOverriddenMethodsMustNotHavePythonCall = (services: SafeDsServices) => { +export const overridingAndOverriddenMethodsMustNotHavePythonMacro = (services: SafeDsServices) => { const builtinAnnotations = services.builtins.Annotations; return (node: SdsFunction, accept: ValidationAcceptor): void => { @@ -233,28 +233,28 @@ export const overridingAndOverriddenMethodsMustNotHavePythonCall = (services: Sa return; } - // Check whether the function calls the `@PythonCall` annotation - const ownPythonCall = builtinAnnotations.getPythonCall(node); - if (ownPythonCall !== undefined) { - accept('error', "An overriding method must not call the '@PythonCall' annotation.", { + // Check whether the function calls the `@PythonMacro` annotation + const ownPythonMacro = builtinAnnotations.getPythonMacro(node); + if (ownPythonMacro !== undefined) { + accept('error', "An overriding method must not call the '@PythonMacro' annotation.", { node, property: 'name', - code: CODE_INHERITANCE_PYTHON_CALL, + code: CODE_INHERITANCE_PYTHON_MACRO, }); return; } - // Check whether the overridden function calls the `@PythonCall` annotation + // Check whether the overridden function calls the `@PythonMacro` annotation if (!isSdsFunction(overriddenMember)) { return; } - const overriddenPythonCall = builtinAnnotations.getPythonCall(overriddenMember); - if (overriddenPythonCall !== undefined) { - accept('error', "Cannot override a method that calls the '@PythonCall' annotation.", { + const overriddenPythonMacro = builtinAnnotations.getPythonMacro(overriddenMember); + if (overriddenPythonMacro !== undefined) { + accept('error', "Cannot override a method that calls the '@PythonMacro' annotation.", { node, property: 'name', - code: CODE_INHERITANCE_PYTHON_CALL, + code: CODE_INHERITANCE_PYTHON_MACRO, }); } }; diff --git a/packages/safe-ds-lang/src/language/validation/safe-ds-validator.ts b/packages/safe-ds-lang/src/language/validation/safe-ds-validator.ts index bf919ffa4..2d979aa3d 100644 --- a/packages/safe-ds-lang/src/language/validation/safe-ds-validator.ts +++ b/packages/safe-ds-lang/src/language/validation/safe-ds-validator.ts @@ -20,7 +20,7 @@ import { requiredParameterMustNotBeExpert } from './builtins/expert.js'; import { pythonCallMustOnlyContainValidTemplateExpressions } from './builtins/pythonCall.js'; import { pythonModuleShouldDifferFromSafeDsPackage } from './builtins/pythonModule.js'; import { - pythonNameMustNotBeSetIfPythonCallIsSet, + pythonNameMustNotBeSetIfPythonMacroIsSet, pythonNameShouldDifferFromSafeDsName, } from './builtins/pythonName.js'; import { singleUseAnnotationsMustNotBeRepeated } from './builtins/repeatable.js'; @@ -35,7 +35,7 @@ import { classMemberMustMatchOverriddenMemberAndShouldBeNeeded, classMustNotInheritItself, classMustOnlyInheritASingleClass, - overridingAndOverriddenMethodsMustNotHavePythonCall, + overridingAndOverriddenMethodsMustNotHavePythonMacro, overridingMemberPythonNameMustMatchOverriddenMember, } from './inheritance.js'; import { @@ -286,8 +286,8 @@ export const registerValidationChecks = function (services: SafeDsServices) { impurityReasonParameterNameMustBelongToParameterOfCorrectType(services), impurityReasonShouldNotBeSetMultipleTimes(services), pythonCallMustOnlyContainValidTemplateExpressions(services), - pythonNameMustNotBeSetIfPythonCallIsSet(services), - overridingAndOverriddenMethodsMustNotHavePythonCall(services), + pythonNameMustNotBeSetIfPythonMacroIsSet(services), + overridingAndOverriddenMethodsMustNotHavePythonMacro(services), ], SdsImport: [importPackageMustExist(services), importPackageShouldNotBeEmpty(services)], SdsImportedDeclaration: [importedDeclarationAliasShouldDifferFromDeclarationName(services)], diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/lang/codeGeneration.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/lang/codeGeneration.sdsstub index 51289b596..eda6ceb1a 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/lang/codeGeneration.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/lang/codeGeneration.sdsstub @@ -1,8 +1,7 @@ package safeds.lang /** - * The specification of a corresponding function call in Python. By default, the function is called as specified in the - * stubs. + * The specification of the corresponding Python code. By default, the function is called as specified in the stubs. * * The specification can contain template expressions, which are replaced by the corresponding arguments of the function * call. `$this` is replaced by the receiver of the call. `$param` is replaced by the value of the parameter called @@ -10,8 +9,8 @@ package safeds.lang */ @Experimental @Targets([AnnotationTarget.Function]) -annotation PythonCall( - callSpecification: String +annotation PythonMacro( + template: String ) /** diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/lang/coreClasses.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/lang/coreClasses.sdsstub index bf4883c28..0bd40bce5 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/lang/coreClasses.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/lang/coreClasses.sdsstub @@ -6,7 +6,7 @@ package safeds.lang class Any { /** - * Returns a string representation of the object. + * Return a string representation of the object. * * @example * pipeline example { @@ -14,8 +14,8 @@ class Any { * } */ @Pure - @PythonCall("str($this)") - fun toString() -> s: String + @PythonMacro("str($this)") + fun toString() -> string: String } /** @@ -54,7 +54,7 @@ class Number class Int sub Number { /** - * Converts this integer to a floating-point number. + * Convert this integer to a floating-point number. * * @example * pipeline example { @@ -62,8 +62,8 @@ class Int sub Number { * } */ @Pure - @PythonCall("float($this)") - fun toFloat() -> f: Float + @PythonMacro("float($this)") + fun toFloat() -> float: Float } /** @@ -75,8 +75,9 @@ class Int sub Number { * } */ class Float sub Number { + /** - * Converts this floating-point number to an integer by truncating the fractional part. + * Convert this floating-point number to an integer by truncating the fractional part. * * @example * pipeline example { @@ -84,8 +85,8 @@ class Float sub Number { * } */ @Pure - @PythonCall("int($this)") - fun toInt() -> i: Int + @PythonMacro("int($this)") + fun toInt() -> int: Int } /** @@ -99,7 +100,39 @@ class Float sub Number { class List { /** - * Returns the number of elements in the list. + * Join the elements of the list into a string using the separator. + * + * @example + * pipeline example { + * val string = [1, 2, 3].join(); // "1, 2, 3" + * } + * + * @example + * pipeline example { + * val string = [1, 2, 3].join("-"); // "1-2-3" + * } + */ + @Pure + @PythonMacro("$separator.join($this)") + fun join(separator: String = ", ") -> string: String + + /** + * Return the slice of the list starting at the start index up to but excluding the end index. + * + * @param start The start index (inclusive). + * @param end The end index (exclusive). Negative indices count from the end of the list. + * + * @example + * pipeline example { + * val slice = [1, 2, 3].slice(1, 3); // [2, 3] + * } + */ + @Pure + @PythonMacro("$this[$start:$end]") + fun slice(start: Int = 0, end: Int = this.size()) -> slice: List + + /** + * Return the number of elements in the list. * * @example * pipeline example { @@ -107,7 +140,7 @@ class List { * } */ @Pure - @PythonCall("len($this)") + @PythonMacro("len($this)") fun size() -> size: Int } @@ -126,7 +159,7 @@ class List { class Map { /** - * Returns the number of entries in the map. + * Return the number of entries in the map. * * @example * pipeline example { @@ -139,11 +172,11 @@ class Map { * } */ @Pure - @PythonCall("len($this)") + @PythonMacro("len($this)") fun size() -> size: Int /** - * Returns the keys of the map. + * Return the keys of the map. * * @example * pipeline example { @@ -156,11 +189,11 @@ class Map { * } */ @Pure - @PythonCall("list($this.keys())") + @PythonMacro("list($this.keys())") fun keys() -> keys: List /** - * Returns the values of the map. + * Return the values of the map. * * @example * pipeline example { @@ -173,7 +206,7 @@ class Map { * } */ @Pure - @PythonCall("list($this.values())") + @PythonMacro("list($this.values())") fun values() -> values: List } @@ -188,7 +221,224 @@ class Map { class String { /** - * Parses the string to a floating-point number. + * Return the number of characters in the string. + * + * @example + * pipeline example { + * val length = "Hello, world!".length(); // 13 + * } + */ + @Pure + @PythonMacro("len($this)") + fun length() -> length: Int + + /** + * Check if the string contains the substring. + * + * @example + * pipeline example { + * val contains = "Hello, world!".contains("world!"); // true + * } + */ + @Pure + @PythonMacro("$substring in $this") + fun contains(substring: String) -> contains: Boolean + + /** + * Check if the string ends with the suffix. + * + * @example + * pipeline example { + * val endsWith = "Hello, world!".endsWith("world!"); // true + * } + */ + @Pure + @PythonMacro("$this.endswith($suffix)") + fun endsWith(suffix: String) -> endsWith: Boolean + + /** + * Check if the string starts with the prefix. + * + * @example + * pipeline example { + * val startsWith = "Hello, world!".startsWith("Hello"); // true + * } + */ + @Pure + @PythonMacro("$this.startswith($prefix)") + fun startsWith(prefix: String) -> startsWith: Boolean + + /** + * Return the substring of the string starting at the start index up to but excluding the end index. + * + * @param start The start index (inclusive). + * @param end The end index (exclusive). + * + * @example + * pipeline example { + * val substring = "Hello, world!".substring(7, 12); // "world" + * } + */ + @Pure + @PythonMacro("$this[$start:$end]") + fun substring(start: Int = 0, end: Int = this.length()) -> substring: String + + /** + * Return the index of the first occurrence of the substring in the string or -1 if the substring is not found. + * + * @example + * pipeline example { + * val index = "Hello, world!".indexOf("o"); // 4 + * } + */ + @Pure + @PythonMacro("$this.find($substring)") + fun indexOf(substring: String) -> index: Int + + /** + * Return the index of the last occurrence of the substring in the string or -1 if the substring is not found. + * + * @example + * pipeline example { + * val index = "Hello, world!".lastIndexOf("o"); // 8 + * } + */ + @Pure + @PythonMacro("$this.rfind($substring)") + fun lastIndexOf(substring: String) -> index: Int + + /** + * Replace all occurrences of the old substring with the new substring. + * + * @example + * pipeline example { + * val replacedString = "Hello, world!".replace("world", "Safe-DS"); // "Hello, Safe-DS!" + * } + */ + @Pure + @PythonMacro("$this.replace($old, $new)") + fun replace(old: String, new: String) -> replacedString: String + + /** + * Repeat the string n times. + * + * @example + * pipeline example { + * val repeatedString = "Ha".repeat(3); // "HaHaHa" + * } + */ + @Pure + @PythonMacro("$this * $n") + fun repeat(n: Int) -> repeatedString: String + + /** + * Split the string into parts using the separator. + * + * @example + * pipeline example { + * val parts = "a,b,c".split(","); // ["a", "b", "c"] + * } + */ + @Pure + @PythonMacro("$this.split($separator)") + fun split(separator: String) -> parts: List + + /** + * Trim leading and trailing whitespace from the string. + * + * @example + * pipeline example { + * val trimmed = " Hello, world! ".trim(); // "Hello, world!" + * } + */ + @Pure + @PythonMacro("$this.strip()") + fun trim() -> trimmed: String + + /** + * Trim leading whitespace from the string. + * + * @example + * pipeline example { + * val trimmed = " Hello, world! ".trimStart(); // "Hello, world! " + * } + */ + @Pure + @PythonMacro("$this.lstrip()") + fun trimStart() -> trimmed: String + + /** + * Trim trailing whitespace from the string. + * + * @example + * pipeline example { + * val trimmed = " Hello, world! ".trimEnd(); // " Hello, world!" + * } + */ + @Pure + @PythonMacro("$this.rstrip()") + fun trimEnd() -> trimmed: String + + /** + * Normalize the casing of a string to make it suitable for case-insensitive matching. This is essentially a more + * aggressive form of lowercasing. For example, the German lowercase letter "ß" gets converted to "ss". + * + * Casefolding is described in section 3.13 of the [Unicode Standard](https://www.unicode.org/versions/latest/). + * + * @example + * pipeline example { + * val casefolded = "Hello, world!".toCasefolded(); // "hello, world!" + * } + * + * @example + * pipeline example { + * val casefolded = "Poststraße".toCasefolded(); // "poststrasse" + * } + */ + @Pure + @PythonMacro("$this.casefold()") + fun toCasefolded() -> casefolded: String + + /** + * Convert the string to lowercase. Prefer {@link String.toCasefolded} for case-insensitive matching. + * + * Lowercasing is described in section 3.13 of the [Unicode Standard](https://www.unicode.org/versions/latest/). + * + * @example + * pipeline example { + * val lowercase = "Hello, world!".toLowercase(); // "hello, world!" + * } + * + * @example + * pipeline example { + * val lowercase = "Poststraße".toLowercase(); // "poststraße" + * } + */ + @Pure + @PythonMacro("$this.lower()") + fun toLowercase() -> lowercase: String + + /** + * Convert the string to uppercase. Prefer {@link String.toCasefolded} for case-insensitive matching. + * + * Uppercasing is described in section 3.13 of the [Unicode Standard](https://www.unicode.org/versions/latest/). + * + * @example + * pipeline example { + * val uppercase = "Hello, world!".toUppercase(); // "HELLO, WORLD!" + * } + * + * @example + * pipeline example { + * val uppercase = "Poststraße".toUppercase(); // "POSTSTRASSE" + * } + */ + @Pure + @PythonMacro("$this.upper()") + fun toUppercase() -> uppercase: String + + /** + * Parse the string to a floating-point number. * * @example * pipeline example { @@ -196,11 +446,11 @@ class String { * } */ @Pure - @PythonCall("float($this)") - fun toFloat() -> f: Float + @PythonMacro("float($this)") + fun toFloat() -> float: Float /** - * Parses the string to an integer. + * Parse the string to an integer. * * @param base The base of the integer. * @@ -215,6 +465,6 @@ class String { * } */ @Pure - @PythonCall("int($this, $base)") - fun toInt(base: Int = 10) -> i: Int + @PythonMacro("int($this, $base)") + fun toInt(base: Int = 10) -> int: Int } diff --git a/packages/safe-ds-lang/src/resources/builtins/safeds/lang/purity.sdsstub b/packages/safe-ds-lang/src/resources/builtins/safeds/lang/purity.sdsstub index c895b615d..010764f1a 100644 --- a/packages/safe-ds-lang/src/resources/builtins/safeds/lang/purity.sdsstub +++ b/packages/safe-ds-lang/src/resources/builtins/safeds/lang/purity.sdsstub @@ -1,7 +1,7 @@ package safeds.lang /** - * Indicates that the function has no side effects and always returns the same results given the same arguments. + * The function has no side effects and always returns the same results given the same arguments. * * Calls to such a function may be eliminated, if its results are not used. Moreover, the function can be memoized, i.e. * we can remember its results for a set of arguments. Finally, a pure function can be called at any time, allowing @@ -12,10 +12,11 @@ package safeds.lang annotation Pure /** - * Indicates that the function has side effects and/or does not always return the same results given the same arguments. + * The function has side effects and/or does not always return the same results given the same arguments. * * @param allReasons - * A list of **all** reasons why the function is impure. If no specific {@link ImpurityReason} applies, include `ImpurityReason.Other`. + * A list of **all** reasons why the function is impure. If no specific {@link ImpurityReason} applies, include + * `ImpurityReason.Other`. */ @Experimental @Targets([AnnotationTarget.Function]) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py index ec0b4de2e..ca0c62737 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py @@ -23,5 +23,5 @@ def __gen_lambda_3(a, b=2): def __gen_lambda_4(a, b=2): __gen_block_lambda_result_d = g() return __gen_block_lambda_result_d - c = f3(__gen_lambda_4) - g2(c) + __gen_c = f3(__gen_lambda_4) + g2(__gen_c) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py.map index 488343bce..d3a808175 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/block lambda/generated/tests/generator/blockLambda/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["test","a","b","d","g","f1","f2","g2","f3","c"],"mappings":"AAAA;;;;;;AASA,IAASA,IAAI;IACN,mBAACC,CAAC,EAAOC,CAAC,CAAQ,CAAC;QAClB,0BAAMC,CAAC,GAAGC,CAAC;QADZ,OACC,0BAAMD,CAAC;IADXE,EAAE,CAAC;IAGA,mBAACJ,CAAC,EAAOC,CAAC;QACT,0BAAMC,CAAC,GAAGC,CAAC;QADZ,OACC,0BAAMD,CAAC;IADXE,EAAE,CAAC;IAGA;QAAG,IAAE;IAARC,EAAE,CAAC;IACG,mBAACL,CAAC,EAAOC,CAAC,CAAQ,CAAC;QACrB,0BAAMC,CAAC,GAAGC,CAAC;QADT,OACF,0BAAMD,CAAC;IADXI,EAAE,CAACC,EAAE,CAAC;IAGK,mBAACP,CAAC,EAAOC,CAAC,CAAQ,CAAC;QAC1B,0BAAMC,CAAC,GAAGC,CAAC;QADJ,OACP,0BAAMD,CAAC;IADX,IAAQK,EAAE,CAAC;IAGXD,EAAE,CAACE,CAAC","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["test","a","b","d","g","f1","f2","g2","f3","c"],"mappings":"AAAA;;;;;;AASA,IAASA,IAAI;IACN,mBAACC,CAAC,EAAOC,CAAC,CAAQ,CAAC;QAClB,0BAAMC,CAAC,GAAGC,CAAC;QADZ,OACC,0BAAMD,CAAC;IADXE,EAAE,CAAC;IAGA,mBAACJ,CAAC,EAAOC,CAAC;QACT,0BAAMC,CAAC,GAAGC,CAAC;QADZ,OACC,0BAAMD,CAAC;IADXE,EAAE,CAAC;IAGA;QAAG,IAAE;IAARC,EAAE,CAAC;IACG,mBAACL,CAAC,EAAOC,CAAC,CAAQ,CAAC;QACrB,0BAAMC,CAAC,GAAGC,CAAC;QADT,OACF,0BAAMD,CAAC;IADXI,EAAE,CAACC,EAAE,CAAC;IAGK,mBAACP,CAAC,EAAOC,CAAC,CAAQ,CAAC;QAC1B,0BAAMC,CAAC,GAAGC,CAAC;QADJ,OACP,0BAAMD,CAAC;IADX,UAAQK,EAAE,CAAC;IAGXD,EAAE,CAACE,OAAC","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py index 55f239984..8dbd2efe8 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py @@ -20,14 +20,14 @@ def test(): f(h(1, param_2=2)) f(h(2, param_2=1)) f(h(2)) - 'abc'.i() - 'abc'.j(123) - k(456, 1.23) + (('abc').i()) + (('abc').j((123))) + (k((456), (1.23))) __gen_null_safe_call(f, lambda: f(g(1, param2=2))) __gen_null_safe_call(f, lambda: f(g(2, param2=1))) __gen_null_safe_call(f, lambda: f(h(1, param_2=2))) __gen_null_safe_call(f, lambda: f(h(2, param_2=1))) __gen_null_safe_call(f, lambda: f(h(2))) - __gen_null_safe_call(i, lambda: 'abc'.i()) - __gen_null_safe_call(j, lambda: 'abc'.j(123)) - __gen_null_safe_call(k, lambda: k(456, 1.23)) + __gen_null_safe_call(i, lambda: (('abc').i())) + __gen_null_safe_call(j, lambda: (('abc').j((123)))) + __gen_null_safe_call(k, lambda: (k((456), (1.23)))) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py.map index d5d952344..461d6edf2 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/generated/tests/generator/call/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["test","f","g","param2","h","i","j","k"],"mappings":"AAAA;;;;;;;;;;;;;;;;AA0BA,IAASA,IAAI;IACTC,CAAC,CAAEC,CAAC,CAAC,CAAC,EArBNC,MAAM,CAqBE,CAAC;IACTF,CAAC,CAAEC,CAAC,CAAsB,CAAC,EAtB3BC,MAAM,CAsBQ,CAAC;IACfF,CAAC,CAAEG,CAAC,CAAC,CAAC,EAlBiBD,OAAM,CAkBrB,CAAC;IACTF,CAAC,CAAEG,CAAC,CAAsB,CAAC,EAnBJD,OAAM,CAmBf,CAAC;IACfF,CAAC,CAAEG,CAAC,CAAU,CAAC;IACb,KAAK;IACL,KAAK,GAAE,GAAG;IACZ,EAAQ,GAAG,EAAT,IAAI;IAEL,oBAAC,CAAFH,CAAC,UAADA,CAAC,CAAGC,CAAC,CAAC,CAAC,EA9BPC,MAAM,CA8BG,CAAC;IACT,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAGC,CAAC,CAAsB,CAAC,EA/B5BC,MAAM,CA+BS,CAAC;IACf,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAGG,CAAC,CAAC,CAAC,EA3BgBD,OAAM,CA2BpB,CAAC;IACT,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAGG,CAAC,CAAsB,CAAC,EA5BLD,OAAM,CA4Bd,CAAC;IACf,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAGG,CAAC,CAAU,CAAC;IACf,oBAAC,CAAFC,CAAC,UAAE,KAAK;IACP,oBAAC,CAAFC,CAAC,UAAE,KAAK,GAAE,GAAG;IACZ,oBAAC,CAAFC,CAAC,UAAD,EAAS,GAAG,EAAT,IAAI","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["test","f","g","param2","h","i","j","k"],"mappings":"AAAA;;;;;;;;;;;;;;;;AA0BA,IAASA,IAAI;IACTC,CAAC,CAAEC,CAAC,CAAC,CAAC,EArBNC,MAAM,CAqBE,CAAC;IACTF,CAAC,CAAEC,CAAC,CAAsB,CAAC,EAtB3BC,MAAM,CAsBQ,CAAC;IACfF,CAAC,CAAEG,CAAC,CAAC,CAAC,EAlBiBD,OAAM,CAkBrB,CAAC;IACTF,CAAC,CAAEG,CAAC,CAAsB,CAAC,EAnBJD,OAAM,CAmBf,CAAC;IACfF,CAAC,CAAEG,CAAC,CAAU,CAAC;IACf,CAAA,CAAE,KAAK;IACP,CAAA,CAAE,KAAK,KAAE,GAAG;IACZ,CAAA,GAAQ,GAAG,IAAT,IAAI;IAEL,oBAAC,CAAFH,CAAC,UAADA,CAAC,CAAGC,CAAC,CAAC,CAAC,EA9BPC,MAAM,CA8BG,CAAC;IACT,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAGC,CAAC,CAAsB,CAAC,EA/B5BC,MAAM,CA+BS,CAAC;IACf,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAGG,CAAC,CAAC,CAAC,EA3BgBD,OAAM,CA2BpB,CAAC;IACT,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAGG,CAAC,CAAsB,CAAC,EA5BLD,OAAM,CA4Bd,CAAC;IACf,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAGG,CAAC,CAAU,CAAC;IACf,oBAAC,CAAFC,CAAC,WAAD,CAAG,KAAK;IACP,oBAAC,CAAFC,CAAC,WAAD,CAAG,KAAK,KAAE,GAAG;IACZ,oBAAC,CAAFC,CAAC,WAAD,GAAS,GAAG,IAAT,IAAI","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/input.sdsdev b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/input.sdsdev index 8d61c895e..2486bb18a 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/input.sdsdev +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/call/input.sdsdev @@ -13,15 +13,15 @@ package tests.generator.call ) -> result: Boolean @Impure([ImpurityReason.Other]) -@PythonCall("$param.i()") +@PythonMacro("$param.i()") fun i(param: Any?) @Impure([ImpurityReason.Other]) -@PythonCall("$param.j($param2)") +@PythonMacro("$param.j($param2)") fun j(param: Any?, param2: Any?) @Impure([ImpurityReason.Other]) -@PythonCall("k($param2, $param)") +@PythonMacro("k($param2, $param)") fun k(param: Any?, param2: Any?) pipeline test { diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py index c4694ff4b..c023be14d 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py @@ -23,7 +23,7 @@ def test(): f(__gen_null_safe_member_access(factory(), 'a')) f(__gen_null_safe_member_access(factory(), 'c')) __gen_receiver_0 = C() - f(1.i(__gen_receiver_0)) + f(((1).i((__gen_receiver_0)))) f(C().j(123)) f(C().k2('abc')) f(C.from_csv_file('abc.csv')) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py.map index 42c618f95..0ce10d566 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/generated/tests/generator/memberAccess/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["test","f","g","h","result1","result2","c","a","b","factory","j","k","from_csv_file"],"mappings":"AAAA;;;;;;;;;;;;;;;;AA4BA,IAASA,IAAI;IACTC,CAAC,CAACC,CAAC;IACHD,CAAC,CAACE,CAAC,GAAGC,CAAO;IACbH,CAAC,CAACE,CAAC,GAAGE,CAAO;IACbJ,CAAC,CAACK,CAAC,GAAGC,CAAC;IACPN,CAAC,CAACK,CAAC,GAAGE,CAAC;IACPP,CAAC,CAAU,6BAAC,CAAVQ,OAAO,KAAIF,CAAC;IACdN,CAAC,CAAU,6BAAC,CAAVQ,OAAO,KAAID,CAAC;IACZ,mBAAAF,CAAC;IAAHL,CAAC,CAAO,CAAC;IACTA,CAAC,CAACK,CAAC,GAAGI,CAAC,CAAC,GAAG;IACXT,CAAC,CAACK,CAAC,GAAGK,EAAC,CAAC,KAAK;IACbV,CAAC,CAACK,CAAC,CAACM,aAAa,CAAC,SAAS","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["test","f","g","h","result1","result2","c","a","b","factory","j","k","from_csv_file"],"mappings":"AAAA;;;;;;;;;;;;;;;;AA4BA,IAASA,IAAI;IACTC,CAAC,CAACC,CAAC;IACHD,CAAC,CAACE,CAAC,GAAGC,CAAO;IACbH,CAAC,CAACE,CAAC,GAAGE,CAAO;IACbJ,CAAC,CAACK,CAAC,GAAGC,CAAC;IACPN,CAAC,CAACK,CAAC,GAAGE,CAAC;IACPP,CAAC,CAAU,6BAAC,CAAVQ,OAAO,KAAIF,CAAC;IACdN,CAAC,CAAU,6BAAC,CAAVQ,OAAO,KAAID,CAAC;IACZ,mBAAAF,CAAC;IAAHL,CAAC,CAAC,CAAA,CAAM,CAAC;IACTA,CAAC,CAACK,CAAC,GAAGI,CAAC,CAAC,GAAG;IACXT,CAAC,CAACK,CAAC,GAAGK,EAAC,CAAC,KAAK;IACbV,CAAC,CAACK,CAAC,CAACM,aAAa,CAAC,SAAS","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/input.sdsdev b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/input.sdsdev index f97e9b240..331be0bfe 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/input.sdsdev +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/member access/input.sdsdev @@ -11,7 +11,7 @@ class C() { @PythonName("c") attr b: Int @Pure - @PythonCall("$param.i($this)") + @PythonMacro("$param.i($this)") fun i(param: Any?) -> result: Boolean @Pure diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/type casts/generated/tests/generation/expressions/typeCasts/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/expressions/type casts/generated/tests/generation/expressions/typeCasts/gen_input.py index e3ecd097a..e31ba952c 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/type casts/generated/tests/generation/expressions/typeCasts/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/type casts/generated/tests/generation/expressions/typeCasts/gen_input.py @@ -1,4 +1,4 @@ # Segments --------------------------------------------------------------------- def mySegment(p): - a = p + __gen_a = p diff --git a/packages/safe-ds-lang/tests/resources/generation/python/expressions/type casts/generated/tests/generation/expressions/typeCasts/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/expressions/type casts/generated/tests/generation/expressions/typeCasts/gen_input.py.map index 6ab13050a..6a7fd1c4d 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/expressions/type casts/generated/tests/generation/expressions/typeCasts/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/expressions/type casts/generated/tests/generation/expressions/typeCasts/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["mysegment","p"],"mappings":"AAAA;;AAEA,IAAQA,SAAS,CAACC,CAAC;IACf,IAAQA,CAAC","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["mysegment","p"],"mappings":"AAAA;;AAEA,IAAQA,SAAS,CAACC,CAAC;IACf,UAAQA,CAAC","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/imports/safeds/generated/tests/generator/safeds/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/imports/safeds/generated/tests/generator/safeds/gen_input.py index dfb67fca9..58c8dc649 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/imports/safeds/generated/tests/generator/safeds/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/imports/safeds/generated/tests/generator/safeds/gen_input.py @@ -5,4 +5,4 @@ # Pipelines -------------------------------------------------------------------- def test(): - a = Table() + __gen_a = Table() diff --git a/packages/safe-ds-lang/tests/resources/generation/python/imports/safeds/generated/tests/generator/safeds/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/imports/safeds/generated/tests/generator/safeds/gen_input.py.map index 834ab7021..f770230fa 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/imports/safeds/generated/tests/generator/safeds/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/imports/safeds/generated/tests/generator/safeds/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["test","table"],"mappings":"AAEA;;;;;;AAEA,IAASA,IAAI;IACT,IAAQC,KAAK","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["test","table"],"mappings":"AAEA;;;;;;AAEA,IAASA,IAAI;IACT,UAAQC,KAAK","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/generated/tests/generation/python/macros/strings/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/generated/tests/generation/python/macros/strings/gen_input.py new file mode 100644 index 000000000..8509998c7 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/generated/tests/generation/python/macros/strings/gen_input.py @@ -0,0 +1,39 @@ +# Pipelines -------------------------------------------------------------------- + +def myPipeline(): + __gen_receiver_0 = 'Hello, world!' + __gen_contains = (('world') in (__gen_receiver_0)) + __gen_receiver_1 = 'Hello, world!' + __gen_endsWith = ((__gen_receiver_1).endswith(('world!'))) + __gen_receiver_2 = 'Hello, world!' + __gen_indexOf = ((__gen_receiver_2).find(('o'))) + __gen_receiver_3 = 'Hello, world!' + __gen_lastIndexOf = ((__gen_receiver_3).rfind(('o'))) + __gen_receiver_4 = 'Hello, world!' + __gen_length = (len((__gen_receiver_4))) + __gen_receiver_5 = 'Hello, world!' + __gen_repeat = ((__gen_receiver_5) * (2)) + __gen_receiver_6 = 'Hello, world!' + __gen_replace = ((__gen_receiver_6).replace(('world'), ('planet'))) + __gen_receiver_7 = 'Hello, world!' + __gen_split = ((__gen_receiver_7).split((', '))) + __gen_receiver_8 = 'Hello, world!' + __gen_startsWith = ((__gen_receiver_8).startswith(('Hello'))) + __gen_receiver_9 = 'Hello, world!' + __gen_substring = ((__gen_receiver_9)[(7):()]) + __gen_receiver_10 = 'Hello, world!' + __gen_casefolded = ((__gen_receiver_10).casefold()) + __gen_receiver_11 = '3.14' + __gen_float = (float((__gen_receiver_11))) + __gen_receiver_12 = '42' + __gen_int = (int((__gen_receiver_12), ())) + __gen_receiver_13 = 'Hello, world!' + __gen_lowercase = ((__gen_receiver_13).lower()) + __gen_receiver_14 = 'Hello, world!' + __gen_uppercase = ((__gen_receiver_14).upper()) + __gen_receiver_15 = ' Hello, world! ' + __gen_trimmed = ((__gen_receiver_15).strip()) + __gen_receiver_16 = ' Hello, world! ' + __gen_trimmedEnd = ((__gen_receiver_16).rstrip()) + __gen_receiver_17 = ' Hello, world! ' + __gen_trimmedStart = ((__gen_receiver_17).lstrip()) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/generated/tests/generation/python/macros/strings/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/generated/tests/generation/python/macros/strings/gen_input.py.map new file mode 100644 index 000000000..cc4a50970 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/generated/tests/generation/python/macros/strings/gen_input.py.map @@ -0,0 +1 @@ +{"version":3,"sources":["input.sdsdev"],"names":["mypipeline"],"mappings":"AAAA;;AAEA,IAASA,UAAU;IACA,mBAAA;IAAf,kBAAe,CAAyB,OAAO;IAChC,mBAAA;IAAf,kBAAe,6BAAyB,QAAQ;IAClC,mBAAA;IAAd,iBAAc,yBAAwB,GAAG;IACvB,mBAAA;IAAlB,qBAAkB,0BAA4B,GAAG;IACpC,mBAAA;IAAb,gBAAa;IACA,mBAAA;IAAb,gBAAa,sBAAuB,CAAC;IACvB,mBAAA;IAAd,iBAAc,4BAAwB,OAAO,IAAE,QAAQ;IAC3C,mBAAA;IAAZ,eAAY,0BAAsB;IACjB,mBAAA;IAAjB,oBAAiB,+BAA2B,OAAO;IACnC,mBAAA;IAAhB,mBAAgB,oBAA0B,CAAC;IAC1B,oBAAA;IAAjB,oBAAiB;IACL,oBAAA,MAAM;IAAlB,eAAY,0BAAgB;IAClB,oBAAA,IAAI;IAAd,aAAU;IACM,oBAAA;IAAhB,mBAAgB;IACA,oBAAA;IAAhB,mBAAgB;IACF,oBAAA;IAAd,iBAAc;IACG,oBAAA;IAAjB,oBAAiB;IACE,oBAAA;IAAnB,sBAAmB","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/generated/tests/generation/python/macros/strings/gen_input_myPipeline.py b/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/generated/tests/generation/python/macros/strings/gen_input_myPipeline.py new file mode 100644 index 000000000..beb776a1f --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/generated/tests/generation/python/macros/strings/gen_input_myPipeline.py @@ -0,0 +1,4 @@ +from .gen_input import myPipeline + +if __name__ == '__main__': + myPipeline() diff --git a/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/input.sdsdev b/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/input.sdsdev new file mode 100644 index 000000000..0421bf630 --- /dev/null +++ b/packages/safe-ds-lang/tests/resources/generation/python/macros/strings/input.sdsdev @@ -0,0 +1,22 @@ +package tests.generation.python.macros.strings + +pipeline myPipeline { + val contains = "Hello, world!".contains("world"); + val endsWith = "Hello, world!".endsWith("world!"); + val indexOf = "Hello, world!".indexOf("o"); + val lastIndexOf = "Hello, world!".lastIndexOf("o"); + val length = "Hello, world!".length(); + val repeat = "Hello, world!".repeat(2); + val replace = "Hello, world!".replace("world", "planet"); + val split = "Hello, world!".split(", "); + val startsWith = "Hello, world!".startsWith("Hello"); + val substring = "Hello, world!".substring(7); + val casefolded = "Hello, world!".toCasefolded(); + val float = "3.14".toFloat(); + val int = "42".toInt(); + val lowercase = "Hello, world!".toLowercase(); + val uppercase = "Hello, world!".toUppercase(); + val trimmed = " Hello, world! ".trim(); + val trimmedEnd = " Hello, world! ".trimEnd(); + val trimmedStart = " Hello, world! ".trimStart(); +} diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py index ad319da7f..eaa15a7da 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py @@ -5,10 +5,10 @@ # Pipelines -------------------------------------------------------------------- def testPipeline(): - impureFileWrite = iFileWriteA() - impureFileWrite2 = iFileWriteA() - impureFileReadAgain = iFileReadA() - impureFileWriteB = iFileWriteB() - impureFileWrite2B = iFileWriteB() - impureFileReadAgainB = iFileReadB() - result = (impureFileReadAgain) + (impureFileReadAgainB) + __gen_impureFileWrite = iFileWriteA() + __gen_impureFileWrite2 = iFileWriteA() + __gen_impureFileReadAgain = iFileReadA() + __gen_impureFileWriteB = iFileWriteB() + __gen_impureFileWrite2B = iFileWriteB() + __gen_impureFileReadAgainB = iFileReadB() + __gen_result = (__gen_impureFileReadAgain) + (__gen_impureFileReadAgainB) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py.map index 8e0f4bac6..6b46c98c5 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file constant/generated/tests/generator/partialImpureDependencyFileConstant/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","ifilewritea","ifilereada","ifilewriteb","ifilereadb","impurefilereadagain","impurefilereadagainb"],"mappings":"AAAA;;;;;;AAUA,IAASA,YAAY;IAEjB,kBAAsBC,WAAW;IACjC,mBAAuBA,WAAW;IAClC,sBAA0BC,UAAU;IAGpC,mBAAuBC,WAAW;IAClC,oBAAwBA,WAAW;IACnC,uBAA2BC,UAAU;IAGrC,SAAe,CAAAC,mBAAmB,EAAC,CAAC,EAACC,oBAAoB","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","ifilewritea","ifilereada","ifilewriteb","ifilereadb","impurefilereadagain","impurefilereadagainb"],"mappings":"AAAA;;;;;;AAUA,IAASA,YAAY;IAEjB,wBAAsBC,WAAW;IACjC,yBAAuBA,WAAW;IAClC,4BAA0BC,UAAU;IAGpC,yBAAuBC,WAAW;IAClC,0BAAwBA,WAAW;IACnC,6BAA2BC,UAAU;IAGrC,eAAe,CAAAC,yBAAmB,EAAC,CAAC,EAACC,0BAAoB","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py index 07960948a..1462598a4 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py @@ -5,7 +5,7 @@ # Pipelines -------------------------------------------------------------------- def testPipeline(): - impureFileWrite = iFileWrite('b.txt') - impureFileWrite2 = iFileWrite('c.txt') - impureFileReadAgain = iFileRead('d.txt') - result = (impureFileReadAgain) + (2) + __gen_impureFileWrite = iFileWrite('b.txt') + __gen_impureFileWrite2 = iFileWrite('c.txt') + __gen_impureFileReadAgain = iFileRead('d.txt') + __gen_result = (__gen_impureFileReadAgain) + (2) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py.map index f5b3871fa..c89ae9078 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency file parameter/generated/tests/generator/partialImpureDependencyFileParameter/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","ifilewrite","ifileread","impurefilereadagain"],"mappings":"AAAA;;;;;;AAMA,IAASA,YAAY;IAEjB,kBAAsBC,UAAU,CAAC,OAAO;IACxC,mBAAuBA,UAAU,CAAC,OAAO;IACzC,sBAA0BC,SAAS,CAAC,OAAO;IAG3C,SAAe,CAAAC,mBAAmB,EAAC,CAAC,EAAC,CAAC","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","ifilewrite","ifileread","impurefilereadagain"],"mappings":"AAAA;;;;;;AAMA,IAASA,YAAY;IAEjB,wBAAsBC,UAAU,CAAC,OAAO;IACxC,yBAAuBA,UAAU,CAAC,OAAO;IACzC,4BAA0BC,SAAS,CAAC,OAAO;IAG3C,eAAe,CAAAC,yBAAmB,EAAC,CAAC,EAAC,CAAC","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py index c6f1be1d2..49c20ad20 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py @@ -6,17 +6,17 @@ def testPipeline(): i1(1) - impureFileWrite = iFileWrite() - impureFileWrite2 = iFileWrite() - pureValueForImpure2 = noPartialEvalInt(2) - pureValueForImpure3 = 3 + __gen_impureFileWrite = iFileWrite() + __gen_impureFileWrite2 = iFileWrite() + __gen_pureValueForImpure2 = noPartialEvalInt(2) + __gen_pureValueForImpure3 = 3 def __gen_lambda_0(): i1(1) __gen_block_lambda_result_r = 1 return __gen_block_lambda_result_r fp(__gen_lambda_0) i1(1) - impureA1 = i1(pureValueForImpure2) - impureA2 = i1(noPartialEvalInt(3)) + __gen_impureA1 = i1(__gen_pureValueForImpure2) + __gen_impureA2 = i1(noPartialEvalInt(3)) i1(4) - result = i1(impureA2) + __gen_result = i1(__gen_impureA2) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py.map index 0082852a5..33bd132b1 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/impure dependency/generated/tests/generator/partialImpureDependency/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","i1","ifilewrite","nopartialevalint","r","fp","purevalueforimpure2","purevalueforimpure3","impurea2"],"mappings":"AAAA;;;;;;AAeA,IAASA,YAAY;IACjBC,EAAE,CAAC,CAAC;IAGJ,kBAAsBC,UAAU;IAChC,mBAAuBA,UAAU;IAEjC,sBAA0BC,gBAAgB,CAAC,CAAC;IAC5C,sBAA0B,CAAC;IAExB;QACCF,EAAE,CAAC,CAAC;QACJ,0BAAMG,CAAC,GAAG,CAAC;QAFZ,OAEC,0BAAMA,CAAC;IAFXC,EAAE,CAAC;IAIHJ,EAAE,CAAC,CAAC;IACJ,WAAeA,EAAE,CAACK,mBAAmB;IACrC,WAAeL,EAAE,CAACE,gBAAgB,CAACI,CAAmB;IACtDN,EAAE,CAAC,CAAC;IAGJ,SAAeA,EAAE,CAACO,QAAQ","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","i1","ifilewrite","nopartialevalint","r","fp","purevalueforimpure2","purevalueforimpure3","impurea2"],"mappings":"AAAA;;;;;;AAeA,IAASA,YAAY;IACjBC,EAAE,CAAC,CAAC;IAGJ,wBAAsBC,UAAU;IAChC,yBAAuBA,UAAU;IAEjC,4BAA0BC,gBAAgB,CAAC,CAAC;IAC5C,4BAA0B,CAAC;IAExB;QACCF,EAAE,CAAC,CAAC;QACJ,0BAAMG,CAAC,GAAG,CAAC;QAFZ,OAEC,0BAAMA,CAAC;IAFXC,EAAE,CAAC;IAIHJ,EAAE,CAAC,CAAC;IACJ,iBAAeA,EAAE,CAACK,yBAAmB;IACrC,iBAAeL,EAAE,CAACE,gBAAgB,CAACI,CAAmB;IACtDN,EAAE,CAAC,CAAC;IAGJ,eAAeA,EAAE,CAACO,cAAQ","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py index ac4f1adaa..07cae0cae 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py @@ -5,30 +5,30 @@ # Pipelines -------------------------------------------------------------------- def testPipeline(): - lFalse = False - lDouble = -1.0 - lInt = 1 - lNull = None - lStrMulti = 'multi\nline' - boolean1 = True - value1 = g(True, -1.0, 1, None, 'multi\nline') + __gen_lFalse = False + __gen_lDouble = -1.0 + __gen_lInt = 1 + __gen_lNull = None + __gen_lStrMulti = 'multi\nline' + __gen_boolean1 = True + __gen_value1 = g(True, -1.0, 1, None, 'multi\nline') def __gen_lambda_0(): - i = 1 - i2 = 3 - j = 6 - j2 = 4 + __gen_i = 1 + __gen_i2 = 3 + __gen_j = 6 + __gen_j2 = 4 __gen_block_lambda_result_z = 7 return __gen_block_lambda_result_z def __gen_lambda_1(): return 2 - o = (f(__gen_lambda_0)) + (f(__gen_lambda_1)) - mapKey = 'key' - mapValue = 'value' - mapResult = g2({'key': 'value'}) - listV1 = 1 - listV3 = noPartialEvalInt(1) - list = [1] - list3 = [listV3] - listValue = list3[0] - listResult = g3(list) - result = (((-(o)) + (1)) + (value1)) + (((mapResult) * (listResult)) / (g4(listValue))) + __gen_o = (f(__gen_lambda_0)) + (f(__gen_lambda_1)) + __gen_mapKey = 'key' + __gen_mapValue = 'value' + __gen_mapResult = g2({'key': 'value'}) + __gen_listV1 = 1 + __gen_listV3 = noPartialEvalInt(1) + __gen_list = [1] + __gen_list3 = [__gen_listV3] + __gen_listValue = __gen_list3[0] + __gen_listResult = g3(__gen_list) + __gen_result = (((-(__gen_o)) + (1)) + (__gen_value1)) + (((__gen_mapResult) * (__gen_listResult)) / (g4(__gen_listValue))) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py.map index f2586ccfa..38394bc7a 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/pure dependency/generated/tests/generator/partialPureDependency/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","false","null","g","boolean1","ldouble","lint","lnull","lstrmulti","z","f","g2","mapkey","mapvalue","nopartialevalint","listv1","listv3","list3","g3","list","o","value1","mapresult","listresult","g4","listvalue"],"mappings":"AAAA;;;;;;AAcA,IAASA,YAAY;IACjB,SAAaC,KAAK;IAGlB,UAAc,IAAI;IAGlB,OAAW,CAAC;IAGZ,QAAYC,IAAI;IAGhB,YAAgB;IAIhB,WAAe;IAGf,SAAaC,CAAC,CAACC,IAAQ,EAAEC,IAAO,EAAEC,CAAI,EAAEC,IAAK,EAAEC,aAAS;IAG9C;QACN,IAAQ,CAAC;QACT,KAAS,CAAC;QACV,IAAQ;QACR,KAAS;QACT,0BAAMC,CAAC,GAAG;QALJ,OAKN,0BAAMA,CAAC;IACJ;eAAM,CAAC;IANd,IAAQ,CAAAC,CAAC,CAAC,iBAMP,CAAC,EAACA,CAAC,CAAC;IAcP,SAAa,KAAK;IAClB,WAAe,OAAO;IACtB,YAAgBC,EAAE,CAAC,CAACC,KAAM,EAAEC,OAAQ;IAMpC,SAAa,CAAC;IAEd,SAAaC,gBAAgB,CAACC,CAAM;IAEpC,OAAW,CAACA,CAAM;IAElB,QAAY,CAACC,MAAM;IACnB,YAAgBC,KAAK,CAAC,CAAC;IAEvB,aAAiBC,EAAE,CAACC,IAAI;IAIxB,SAAe,CAAO,CAAP,CAAA,CAAC,CAAAC,CAAC,GAAC,CAAC,EAAC,CAAC,GAAC,CAAC,EAACC,MAAM,GAAC,CAAC,EAAwB,CAAvB,CAAAC,SAAS,EAAC,CAAC,EAACC,UAAU,GAAC,CAAC,EAACC,EAAE,CAACC,SAAS","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","false","null","g","boolean1","ldouble","lint","lnull","lstrmulti","z","f","g2","mapkey","mapvalue","nopartialevalint","listv1","listv3","list3","g3","list","o","value1","mapresult","listresult","g4","listvalue"],"mappings":"AAAA;;;;;;AAcA,IAASA,YAAY;IACjB,eAAaC,KAAK;IAGlB,gBAAc,IAAI;IAGlB,aAAW,CAAC;IAGZ,cAAYC,IAAI;IAGhB,kBAAgB;IAIhB,iBAAe;IAGf,eAAaC,CAAC,CAACC,IAAQ,EAAEC,IAAO,EAAEC,CAAI,EAAEC,IAAK,EAAEC,aAAS;IAG9C;QACN,UAAQ,CAAC;QACT,WAAS,CAAC;QACV,UAAQ;QACR,WAAS;QACT,0BAAMC,CAAC,GAAG;QALJ,OAKN,0BAAMA,CAAC;IACJ;eAAM,CAAC;IANd,UAAQ,CAAAC,CAAC,CAAC,iBAMP,CAAC,EAACA,CAAC,CAAC;IAcP,eAAa,KAAK;IAClB,iBAAe,OAAO;IACtB,kBAAgBC,EAAE,CAAC,CAACC,KAAM,EAAEC,OAAQ;IAMpC,eAAa,CAAC;IAEd,eAAaC,gBAAgB,CAACC,CAAM;IAEpC,aAAW,CAACA,CAAM;IAElB,cAAY,CAACC,YAAM;IACnB,kBAAgBC,WAAK,CAAC,CAAC;IAEvB,mBAAiBC,EAAE,CAACC,UAAI;IAIxB,eAAe,CAAO,CAAP,CAAA,CAAC,CAAAC,OAAC,GAAC,CAAC,EAAC,CAAC,GAAC,CAAC,EAACC,YAAM,GAAC,CAAC,EAAwB,CAAvB,CAAAC,eAAS,EAAC,CAAC,EAACC,gBAAU,GAAC,CAAC,EAACC,EAAE,CAACC,eAAS","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py index 58d0694bc..d999eebff 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py @@ -5,5 +5,5 @@ # Pipelines -------------------------------------------------------------------- def testPipeline(): - pureValue = noPartialEvalInt(2) - result = (pureValue) - (1) + __gen_pureValue = noPartialEvalInt(2) + __gen_result = (__gen_pureValue) - (1) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py.map index cce2fb20f..ba973c3bc 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/partial/redundant impurity/generated/tests/generator/partialRedundantImpurity/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","nopartialevalint","purevalue"],"mappings":"AAAA;;;;;;AAeA,IAASA,YAAY;IAMjB,YAAgBC,gBAAgB,CAAC,CAAC;IAalC,SAAe,CAAAC,SAAS,EAAC,CAAC,EAAC,CAAC","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","nopartialevalint","purevalue"],"mappings":"AAAA;;;;;;AAeA,IAASA,YAAY;IAMjB,kBAAgBC,gBAAgB,CAAC,CAAC;IAalC,eAAe,CAAAC,eAAS,EAAC,CAAC,EAAC,CAAC","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/generated/tests/generator/runnerIntegration/expressions/calls/main/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/generated/tests/generator/runnerIntegration/expressions/calls/main/gen_input.py index c49eca17a..ccb7a663a 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/generated/tests/generator/runnerIntegration/expressions/calls/main/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/generated/tests/generator/runnerIntegration/expressions/calls/main/gen_input.py @@ -57,9 +57,9 @@ def test(): {"param_2": 0}, [] )) - 'abc'.i() - 'abc'.j(123) - k(456, 1.23) + (('abc').i()) + (('abc').j((123))) + (k((456), (1.23))) __gen_null_safe_call(f, lambda: f(safeds_runner.memoized_static_call( "tests.generator.runnerIntegration.expressions.calls.main.g", g, @@ -95,9 +95,9 @@ def test(): {"param_2": 0}, [] ))) - __gen_null_safe_call(i, lambda: 'abc'.i()) - __gen_null_safe_call(j, lambda: 'abc'.j(123)) - __gen_null_safe_call(k, lambda: k(456, 1.23)) + __gen_null_safe_call(i, lambda: (('abc').i())) + __gen_null_safe_call(j, lambda: (('abc').j((123)))) + __gen_null_safe_call(k, lambda: (k((456), (1.23)))) f(safeds_runner.memoized_static_call( "tests.generator.runnerIntegration.expressions.calls.main.readFile", readFile, diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/generated/tests/generator/runnerIntegration/expressions/calls/main/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/generated/tests/generator/runnerIntegration/expressions/calls/main/gen_input.py.map index 1bb84504e..39508492e 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/generated/tests/generator/runnerIntegration/expressions/calls/main/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/generated/tests/generator/runnerIntegration/expressions/calls/main/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["segment_a","a","result","test","f","g","h","i","j","k","readfile","l","m"],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiEA,IAAQA,SAAS,CAACC,CAAC;IACf,YAAMC,MAAM,GAAG,CAAAD,CAAC,EAAC,CAAC,EAAC,CAAC;IADE,OAAG;;;;AA9B7B,IAASE,IAAI;IACTC,CAAC,CAAE;;QAAAC,CAAC;SAAC,CAAC;SAAD,UAAG,CAAC;;;IACTD,CAAC,CAAE;;QAAAC,CAAC;SAAsB,CAAC;SAAtB,UAAS,CAAC;;;IACfD,CAAC,CAAE;;QAAAE,CAAC;SAAC,CAAC;SAAD,WAAG,CAAC;;;IACTF,CAAC,CAAE;;QAAAE,CAAC;SAAsB,CAAC;SAAtB,WAAS,CAAC;;;IACfF,CAAC,CAAE;;QAAAE,CAAC;SAAU,CAAC;SAAV,WA7BgC,CAAC;;;IA8BpC,KAAK;IACL,KAAK,GAAE,GAAG;IACZ,EAAQ,GAAG,EAAT,IAAI;IAEL,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAG;;QAAAC,CAAC;SAAC,CAAC;SAAD,UAAG,CAAC;;;IACT,oBAAC,CAAFD,CAAC,UAADA,CAAC,CAAG;;QAAAC,CAAC;SAAsB,CAAC;SAAtB,UAAS,CAAC;;;IACf,oBAAC,CAAFD,CAAC,UAADA,CAAC,CAAG;;QAAAE,CAAC;SAAC,CAAC;SAAD,WAAG,CAAC;;;IACT,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAG;;QAAAE,CAAC;SAAsB,CAAC;SAAtB,WAAS,CAAC;;;IACf,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAG;;QAAAE,CAAC;SAAU,CAAC;SAAV,WAtC+B,CAAC;;;IAuCrC,oBAAC,CAAFC,CAAC,UAAE,KAAK;IACP,oBAAC,CAAFC,CAAC,UAAE,KAAK,GAAE,GAAG;IACZ,oBAAC,CAAFC,CAAC,UAAD,EAAS,GAAG,EAAT,IAAI;IAEPL,CAAC,CAAC;;QAAAM,QAAQ;;;SAAR,iCAAU;;IACR,mBAACT,CAAC;eAAKD,SAAS,CAACC,CAAC;IAAtBG,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;eAAK,CAAA,CAAC,EAAC,CAAC,EAACD,SAAS,CAACC,CAAC;IAA1BG,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;eAAK;;YAAAW,CAAC;aAAC,CAAA,CAAC,EAAC,CAAC,EAACZ,SAAS,CAACC,CAAC;;;;IAA5BG,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;eAAK,CAAA,CAAC,EAAC,CAAC,EAAC;;YAAAW,CAAC;aAAC;;gBAAAA,CAAC;iBAAC,CAAA,CAAC,EAAC,CAAC,EAACZ,SAAS,CAACC,CAAC;;;;;;;IAAlCG,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;QAAG,0BAAMC,MAAM,GAAGF,SAAS,CAACC,CAAC;QAA/B,OAAK,0BAAMC,MAAM;IAArBE,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;QAAG,0BAAMC,MAAM,GAAG;;YAAAU,CAAC;aAACZ,SAAS,CAACC,CAAC;;;;QAAjC,OAAK,0BAAMC,MAAM;IAArBE,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;eAAK,CAAA,CAAC,EAAC,CAAC,EAACA,CAAC;IAAhBG,CAAC,CAAC;;QAAAO,CAAC;SAAC;;;;IACA,mBAACV,CAAC;QAAG,0BAAMC,MAAM,GAAG,CAAA,CAAC,EAAC,CAAC,EAAC;;YAAAU,CAAC;aAACX,CAAC;;;;QAA3B,OAAK,0BAAMC,MAAM;IAArBE,CAAC,CAAC;;QAAAO,CAAC;SAAC","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["segment_a","a","result","test","f","g","h","i","j","k","readfile","l","m"],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiEA,IAAQA,SAAS,CAACC,CAAC;IACf,YAAMC,MAAM,GAAG,CAAAD,CAAC,EAAC,CAAC,EAAC,CAAC;IADE,OAAG;;;;AA9B7B,IAASE,IAAI;IACTC,CAAC,CAAE;;QAAAC,CAAC;SAAC,CAAC;SAAD,UAAG,CAAC;;;IACTD,CAAC,CAAE;;QAAAC,CAAC;SAAsB,CAAC;SAAtB,UAAS,CAAC;;;IACfD,CAAC,CAAE;;QAAAE,CAAC;SAAC,CAAC;SAAD,WAAG,CAAC;;;IACTF,CAAC,CAAE;;QAAAE,CAAC;SAAsB,CAAC;SAAtB,WAAS,CAAC;;;IACfF,CAAC,CAAE;;QAAAE,CAAC;SAAU,CAAC;SAAV,WA7BgC,CAAC;;;IA8BtC,CAAA,CAAE,KAAK;IACP,CAAA,CAAE,KAAK,KAAE,GAAG;IACZ,CAAA,GAAQ,GAAG,IAAT,IAAI;IAEL,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAG;;QAAAC,CAAC;SAAC,CAAC;SAAD,UAAG,CAAC;;;IACT,oBAAC,CAAFD,CAAC,UAADA,CAAC,CAAG;;QAAAC,CAAC;SAAsB,CAAC;SAAtB,UAAS,CAAC;;;IACf,oBAAC,CAAFD,CAAC,UAADA,CAAC,CAAG;;QAAAE,CAAC;SAAC,CAAC;SAAD,WAAG,CAAC;;;IACT,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAG;;QAAAE,CAAC;SAAsB,CAAC;SAAtB,WAAS,CAAC;;;IACf,oBAAC,CAAFF,CAAC,UAADA,CAAC,CAAG;;QAAAE,CAAC;SAAU,CAAC;SAAV,WAtC+B,CAAC;;;IAuCrC,oBAAC,CAAFC,CAAC,WAAD,CAAG,KAAK;IACP,oBAAC,CAAFC,CAAC,WAAD,CAAG,KAAK,KAAE,GAAG;IACZ,oBAAC,CAAFC,CAAC,WAAD,GAAS,GAAG,IAAT,IAAI;IAEPL,CAAC,CAAC;;QAAAM,QAAQ;;;SAAR,iCAAU;;IACR,mBAACT,CAAC;eAAKD,SAAS,CAACC,CAAC;IAAtBG,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;eAAK,CAAA,CAAC,EAAC,CAAC,EAACD,SAAS,CAACC,CAAC;IAA1BG,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;eAAK;;YAAAW,CAAC;aAAC,CAAA,CAAC,EAAC,CAAC,EAACZ,SAAS,CAACC,CAAC;;;;IAA5BG,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;eAAK,CAAA,CAAC,EAAC,CAAC,EAAC;;YAAAW,CAAC;aAAC;;gBAAAA,CAAC;iBAAC,CAAA,CAAC,EAAC,CAAC,EAACZ,SAAS,CAACC,CAAC;;;;;;;IAAlCG,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;QAAG,0BAAMC,MAAM,GAAGF,SAAS,CAACC,CAAC;QAA/B,OAAK,0BAAMC,MAAM;IAArBE,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;QAAG,0BAAMC,MAAM,GAAG;;YAAAU,CAAC;aAACZ,SAAS,CAACC,CAAC;;;;QAAjC,OAAK,0BAAMC,MAAM;IAArBE,CAAC,CAACO,CAAC,CAAC;IACA,mBAACV,CAAC;eAAK,CAAA,CAAC,EAAC,CAAC,EAACA,CAAC;IAAhBG,CAAC,CAAC;;QAAAO,CAAC;SAAC;;;;IACA,mBAACV,CAAC;QAAG,0BAAMC,MAAM,GAAG,CAAA,CAAC,EAAC,CAAC,EAAC;;YAAAU,CAAC;aAACX,CAAC;;;;QAA3B,OAAK,0BAAMC,MAAM;IAArBE,CAAC,CAAC;;QAAAO,CAAC;SAAC","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/input.sdsdev b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/input.sdsdev index 3a28f78b9..8b9e72860 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/input.sdsdev +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/main/input.sdsdev @@ -13,15 +13,15 @@ package tests.generator.runnerIntegration.expressions.calls.main ) -> result: Boolean @Impure([ImpurityReason.Other]) -@PythonCall("$param.i()") +@PythonMacro("$param.i()") fun i(param: Any?) @Impure([ImpurityReason.Other]) -@PythonCall("$param.j($param2)") +@PythonMacro("$param.j($param2)") fun j(param: Any?, param2: Any?) @Impure([ImpurityReason.Other]) -@PythonCall("k($param2, $param)") +@PythonMacro("k($param2, $param)") fun k(param: Any?, param2: Any?) @Pure diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/of classes/generated/tests/generator/runnerIntegration/expressions/calls/ofClasses/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/of classes/generated/tests/generator/runnerIntegration/expressions/calls/ofClasses/gen_input.py index 04a93ea5b..806e46cc9 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/of classes/generated/tests/generator/runnerIntegration/expressions/calls/ofClasses/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/of classes/generated/tests/generator/runnerIntegration/expressions/calls/ofClasses/gen_input.py @@ -6,11 +6,11 @@ # Pipelines -------------------------------------------------------------------- def test(): - a = safeds_runner.memoized_static_call( + __gen_a = safeds_runner.memoized_static_call( "tests.generator.runnerIntegration.expressions.calls.ofClasses.MyClass", MyClass, [0], {}, [] ) - safeds_runner.save_placeholder('a', a) + safeds_runner.save_placeholder('a', __gen_a) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/of classes/generated/tests/generator/runnerIntegration/expressions/calls/ofClasses/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/of classes/generated/tests/generator/runnerIntegration/expressions/calls/ofClasses/gen_input.py.map index c6f3c3559..acf8f2df4 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/of classes/generated/tests/generator/runnerIntegration/expressions/calls/ofClasses/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/calls/of classes/generated/tests/generator/runnerIntegration/expressions/calls/ofClasses/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["test","myclass"],"mappings":"AAEA;;;;;;;AAIA,IAASA,IAAI;IACT,IAAQ;;QAAAC,OAAO;SAAC,CAAC;;;;IAAjB","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["test","myclass"],"mappings":"AAEA;;;;;;;AAIA,IAASA,IAAI;IACT,UAAQ;;QAAAC,OAAO;SAAC,CAAC;;;;IAAjB","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py index 6cbaad10c..a01926ae4 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py @@ -74,29 +74,17 @@ def test(): {}, [] ) - f(safeds_runner.memoized_static_call( - "tests.generator.memberAccessWithRunnerIntegration.C.i", - lambda *_ : 1.i(__gen_receiver_0), - [__gen_receiver_0, 1], - {}, - [] - )) - c1 = safeds_runner.memoized_static_call( + f(((1).i((__gen_receiver_0)))) + __gen_c1 = safeds_runner.memoized_static_call( "tests.generator.memberAccessWithRunnerIntegration.C", C, [], {}, [] ) - safeds_runner.save_placeholder('c1', c1) - __gen_receiver_1 = c1 - f(safeds_runner.memoized_static_call( - "tests.generator.memberAccessWithRunnerIntegration.C.i", - lambda *_ : 1.i(__gen_receiver_1), - [__gen_receiver_1, 1], - {}, - [] - )) + safeds_runner.save_placeholder('c1', __gen_c1) + __gen_receiver_1 = __gen_c1 + f(((1).i((__gen_receiver_1)))) __gen_receiver_2 = safeds_runner.memoized_static_call( "tests.generator.memberAccessWithRunnerIntegration.C", C, @@ -126,13 +114,7 @@ def test(): [] )) __gen_receiver_4 = C - f(safeds_runner.memoized_static_call( - "tests.generator.memberAccessWithRunnerIntegration.C.l", - lambda *_ : 2.i(), - [2], - {}, - [] - )) + f(((2).i())) __gen_receiver_5 = safeds_runner.memoized_static_call( "tests.generator.memberAccessWithRunnerIntegration.C", C, @@ -147,7 +129,7 @@ def test(): {"param": 213}, [] )) - __gen_receiver_6 = c1 + __gen_receiver_6 = __gen_c1 f(safeds_runner.memoized_dynamic_call( __gen_receiver_6, "m", @@ -211,14 +193,14 @@ def test(): {}, [safeds_runner.file_mtime('abc.csv')] )) - a = safeds_runner.memoized_static_call( + __gen_a = safeds_runner.memoized_static_call( "safeds.data.tabular.containers.Table.from_csv_file", Table.from_csv_file, [safeds_runner.absolute_path('abc.csv')], {}, [safeds_runner.file_mtime('abc.csv')] ) - safeds_runner.save_placeholder('a', a) + safeds_runner.save_placeholder('a', __gen_a) __gen_receiver_10 = safeds_runner.memoized_static_call( "safeds.data.tabular.containers.Table.from_csv_file", Table.from_csv_file, @@ -226,33 +208,33 @@ def test(): {}, [safeds_runner.file_mtime('abc.csv')] ) - a2 = safeds_runner.memoized_dynamic_call( + __gen_a2 = safeds_runner.memoized_dynamic_call( __gen_receiver_10, "remove_columns", [['u']], {}, [] ) - safeds_runner.save_placeholder('a2', a2) - __gen_receiver_11 = a - v = safeds_runner.memoized_dynamic_call( + safeds_runner.save_placeholder('a2', __gen_a2) + __gen_receiver_11 = __gen_a + __gen_v = safeds_runner.memoized_dynamic_call( __gen_receiver_11, "get_column", ['b'], {}, [] ) - safeds_runner.save_placeholder('v', v) - __gen_receiver_12 = v - d = safeds_runner.memoized_dynamic_call( + safeds_runner.save_placeholder('v', __gen_v) + __gen_receiver_12 = __gen_v + __gen_d = safeds_runner.memoized_dynamic_call( __gen_receiver_12, "plot_histogram", [], {}, [] ) - safeds_runner.save_placeholder('d', d) - __gen_receiver_13 = a + safeds_runner.save_placeholder('d', __gen_d) + __gen_receiver_13 = __gen_a __gen_receiver_14 = safeds_runner.memoized_dynamic_call( __gen_receiver_13, "get_column", @@ -260,15 +242,15 @@ def test(): {}, [] ) - p = safeds_runner.memoized_dynamic_call( + __gen_p = safeds_runner.memoized_dynamic_call( __gen_receiver_14, "plot_histogram", [], {}, [] ) - safeds_runner.save_placeholder('p', p) - __gen_receiver_15 = a + safeds_runner.save_placeholder('p', __gen_p) + __gen_receiver_15 = __gen_a __gen_receiver_16 = safeds_runner.memoized_dynamic_call( __gen_receiver_15, "get_column", @@ -283,15 +265,15 @@ def test(): {}, [] ) - r = safeds_runner.memoized_dynamic_call( + __gen_r = safeds_runner.memoized_dynamic_call( __gen_receiver_17, "flip_vertically", [], {}, [] ) - safeds_runner.save_placeholder('r', r) - __gen_receiver_18 = a + safeds_runner.save_placeholder('r', __gen_r) + __gen_receiver_18 = __gen_a __gen_receiver_19 = safeds_runner.memoized_dynamic_call( __gen_receiver_18, "get_column", @@ -313,18 +295,18 @@ def test(): {}, [] ) - q = safeds_runner.memoized_dynamic_call( + __gen_q = safeds_runner.memoized_dynamic_call( __gen_receiver_21, "adjust_contrast", [1.2], {}, [] ) - safeds_runner.save_placeholder('q', q) - f(d) - f(p) - f(r) - f(q) + safeds_runner.save_placeholder('q', __gen_q) + f(__gen_d) + f(__gen_p) + f(__gen_r) + f(__gen_q) f(safeds_runner.memoized_static_call( "tests.generator.memberAccessWithRunnerIntegration.Outer.Nested.f", Outer.Nested.f, @@ -332,24 +314,24 @@ def test(): {}, [] )) - nestedInstance = safeds_runner.memoized_static_call( + __gen_nestedInstance = safeds_runner.memoized_static_call( "tests.generator.memberAccessWithRunnerIntegration.factoryNested", factoryNested, [], {}, [] ) - safeds_runner.save_placeholder('nestedInstance', nestedInstance) - __gen_receiver_22 = nestedInstance - nestedResult = safeds_runner.memoized_dynamic_call( + safeds_runner.save_placeholder('nestedInstance', __gen_nestedInstance) + __gen_receiver_22 = __gen_nestedInstance + __gen_nestedResult = safeds_runner.memoized_dynamic_call( __gen_receiver_22, "g", [], {}, [] ) - safeds_runner.save_placeholder('nestedResult', nestedResult) - f(nestedResult) + safeds_runner.save_placeholder('nestedResult', __gen_nestedResult) + f(__gen_nestedResult) __gen_receiver_23 = safeds_runner.memoized_static_call( "safeds.data.tabular.transformation.OneHotEncoder", OneHotEncoder, @@ -357,20 +339,20 @@ def test(): {}, [] ) - encoder = safeds_runner.memoized_dynamic_call( + __gen_encoder = safeds_runner.memoized_dynamic_call( __gen_receiver_23, "fit", - [a, ['b']], + [__gen_a, ['b']], {}, [] ) - safeds_runner.save_placeholder('encoder', encoder) - __gen_receiver_24 = encoder - transformedTable = safeds_runner.memoized_dynamic_call( + safeds_runner.save_placeholder('encoder', __gen_encoder) + __gen_receiver_24 = __gen_encoder + __gen_transformedTable = safeds_runner.memoized_dynamic_call( __gen_receiver_24, "transform", - [a], + [__gen_a], {}, [] ) - safeds_runner.save_placeholder('transformedTable', transformedTable) + safeds_runner.save_placeholder('transformedTable', __gen_transformedTable) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py.map index b55084a1c..0f7588875 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/generated/tests/generator/memberAccessWithRunnerIntegration/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["test","f","g","h","result1","result2","c","a","b","factory","c1","v","d","p","r","q","factorynested","nestedinstance","nestedresult","onehotencoder","encoder"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;AAwDA,IAASA,IAAI;IACTC,CAAC,CAAC;;QAAAC,CAAC;;;;;IACHD,CAAC,CAAC;;QAAAE,CAAC;;;;MAAGC,CAAO;IACbH,CAAC,CAAC;;QAAAE,CAAC;;;;MAAGE,CAAO;IACbJ,CAAC,CAAC;;QAAAK,CAAC;;;;MAAGC,CAAC;IACPN,CAAC,CAAC;;QAAAK,CAAC;;;;MAAGE,CAAC;IACPP,CAAC,CAAU,6BAAC,CAAV;;QAAAQ,OAAO;;;;QAAIF,CAAC;IACdN,CAAC,CAAU,6BAAC,CAAV;;QAAAQ,OAAO;;;;QAAID,CAAC;IACZ,mBAAA;;QAAAF,CAAC;;;;;IAAHL,CAAC,CAAC;;oBAAM,CAAC;2BAAD,CAAC;;;;IACT,KAAS;;QAAAK,CAAC;;;;;IAAV;IACEI,mBAAAA,EAAE;IAAJT,CAAC,CAAC;;oBAAK,CAAC;2BAAD,CAAC;;;;IACN,mBAAA;;QAAAK,CAAC;;;;;IAAHL,CAAC,CAAC;;;SAAM,GAAG;;;;IACT,mBAAA;;QAAAK,CAAC;;;;;IAAHL,CAAC,CAAC;;;SAAM,KAAK;;;;IACXK,mBAAAA,CAAC;IAAHL,CAAC,CAAC;;oBAAI,CAAC;SAAD,CAAC;;;;IACL,mBAAA;;QAAAK,CAAC;;;;;IAAHL,CAAC,CAAC;;;;SAAM,SAAA,GAAG;;;IACTS,mBAAAA,EAAE;IAAJT,CAAC,CAAC;;;;SAAK,SAAA,GAAG;;;IACVA,CAAC,CAAC;;;;SAAI,SAAA,GAAG;;;IACJ,mBAAA;;;;kBAxCqB,EAAE;;;IAwC5BA,CAAC,CAAC;;;;SAAQ,SAAA,GAAG;;;IACR,mBAAA;;;;kBAzCqB,EAAE;;;IAyC5BA,CAAC,CAAC;;;SAAQ,GAAG;;;;IACR,mBAAA;;;;;;;IAALA,CAAC,CAAC;;;SAAQ,GAAG;;;;IACbA,CAAC,CAAC;;;SAAgB,4BAAA,SAAS;;SAAT,yBAAA,SAAS;;IAC3B,IAAQ;;;SAAkB,4BAAA,SAAS;;SAAT,yBAAA,SAAS;;IAAnC;IAC0B,oBAAA;;;SAAC,4BAAA,SAAS;;SAAT,yBAAA,SAAS;;IAApC,KAAS;;;SAA2C,CAAC,GAAG;;;;IAAxD;IACQM,oBAAAA,CAAC;IAAT,IAAQ;;;SAAY,GAAG;;;;IAAvB;IACQI,oBAAAA,CAAC;IAAT,IAAQ;;;;;;;IAAR;IACQJ,oBAAAA,CAAC;IAAU,oBAAA;;;SAAC,GAAG;;;;IAAvB,IAAQ;;;;;;;IAAR;IACQA,oBAAAA,CAAC;IAAU,oBAAA;;;SAAC,GAAG;;;;IAAe,oBAAA;;;;;;;IAAtC,IAAQ;;;;;;;IAAR;IACQA,oBAAAA,CAAC;IAAU,oBAAA;;;SAAC,GAAG;;;;IAAe,oBAAA;;;;;;;IAAiB,oBAAA;;;;;;;IAAvD,IAAQ;;;SAAiE,GAAG;;;;IAA5E;IACAN,CAAC,CAACW,CAAC;IACHX,CAAC,CAACY,CAAC;IACHZ,CAAC,CAACa,CAAC;IACHb,CAAC,CAACc,CAAC;IACHd,CAAC,CAAC;;;;;;;IACF,iBAAqB;;QAAAe,aAAa;;;;;IAAlC;IACmBC,oBAAAA,cAAc;IAAjC,eAAmB;;;;;;;IAAnB;IACAhB,CAAC,CAACiB,YAAY;IACA,oBAAA;;QAAAC,aAAa;;;;;IAA3B,UAAc;;;SAAoBZ,CAAC,EAAE,CAAC,GAAG;;;;IAAzC;IACuBa,oBAAAA,OAAO;IAA9B,mBAAuB;;;SAAkBb,CAAC;;;;IAA1C","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["test","f","g","h","result1","result2","c","a","b","factory","c1","v","d","p","r","q","factorynested","nestedinstance","nestedresult","onehotencoder","encoder"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;AAwDA,IAASA,IAAI;IACTC,CAAC,CAAC;;QAAAC,CAAC;;;;;IACHD,CAAC,CAAC;;QAAAE,CAAC;;;;MAAGC,CAAO;IACbH,CAAC,CAAC;;QAAAE,CAAC;;;;MAAGE,CAAO;IACbJ,CAAC,CAAC;;QAAAK,CAAC;;;;MAAGC,CAAC;IACPN,CAAC,CAAC;;QAAAK,CAAC;;;;MAAGE,CAAC;IACPP,CAAC,CAAU,6BAAC,CAAV;;QAAAQ,OAAO;;;;QAAIF,CAAC;IACdN,CAAC,CAAU,6BAAC,CAAV;;QAAAQ,OAAO;;;;QAAID,CAAC;IACZ,mBAAA;;QAAAF,CAAC;;;;;IAAHL,CAAC,CAAC,CAAA,CAAM,CAAC;IACT,WAAS;;QAAAK,CAAC;;;;;IAAV;IACEI,mBAAAA,QAAE;IAAJT,CAAC,CAAC,CAAA,CAAK,CAAC;IACN,mBAAA;;QAAAK,CAAC;;;;;IAAHL,CAAC,CAAC;;;SAAM,GAAG;;;;IACT,mBAAA;;QAAAK,CAAC;;;;;IAAHL,CAAC,CAAC;;;SAAM,KAAK;;;;IACXK,mBAAAA,CAAC;IAAHL,CAAC,CAAC,CAAA,CAAI,CAAC;IACL,mBAAA;;QAAAK,CAAC;;;;;IAAHL,CAAC,CAAC;;;;SAAM,SAAA,GAAG;;;IACTS,mBAAAA,QAAE;IAAJT,CAAC,CAAC;;;;SAAK,SAAA,GAAG;;;IACVA,CAAC,CAAC;;;;SAAI,SAAA,GAAG;;;IACJ,mBAAA;;;;kBAxCqB,EAAE;;;IAwC5BA,CAAC,CAAC;;;;SAAQ,SAAA,GAAG;;;IACR,mBAAA;;;;kBAzCqB,EAAE;;;IAyC5BA,CAAC,CAAC;;;SAAQ,GAAG;;;;IACR,mBAAA;;;;;;;IAALA,CAAC,CAAC;;;SAAQ,GAAG;;;;IACbA,CAAC,CAAC;;;SAAgB,4BAAA,SAAS;;SAAT,yBAAA,SAAS;;IAC3B,UAAQ;;;SAAkB,4BAAA,SAAS;;SAAT,yBAAA,SAAS;;IAAnC;IAC0B,oBAAA;;;SAAC,4BAAA,SAAS;;SAAT,yBAAA,SAAS;;IAApC,WAAS;;;SAA2C,CAAC,GAAG;;;;IAAxD;IACQM,oBAAAA,OAAC;IAAT,UAAQ;;;SAAY,GAAG;;;;IAAvB;IACQI,oBAAAA,OAAC;IAAT,UAAQ;;;;;;;IAAR;IACQJ,oBAAAA,OAAC;IAAU,oBAAA;;;SAAC,GAAG;;;;IAAvB,UAAQ;;;;;;;IAAR;IACQA,oBAAAA,OAAC;IAAU,oBAAA;;;SAAC,GAAG;;;;IAAe,oBAAA;;;;;;;IAAtC,UAAQ;;;;;;;IAAR;IACQA,oBAAAA,OAAC;IAAU,oBAAA;;;SAAC,GAAG;;;;IAAe,oBAAA;;;;;;;IAAiB,oBAAA;;;;;;;IAAvD,UAAQ;;;SAAiE,GAAG;;;;IAA5E;IACAN,CAAC,CAACW,OAAC;IACHX,CAAC,CAACY,OAAC;IACHZ,CAAC,CAACa,OAAC;IACHb,CAAC,CAACc,OAAC;IACHd,CAAC,CAAC;;;;;;;IACF,uBAAqB;;QAAAe,aAAa;;;;;IAAlC;IACmBC,oBAAAA,oBAAc;IAAjC,qBAAmB;;;;;;;IAAnB;IACAhB,CAAC,CAACiB,kBAAY;IACA,oBAAA;;QAAAC,aAAa;;;;;IAA3B,gBAAc;;;SAAoBZ,OAAC,EAAE,CAAC,GAAG;;;;IAAzC;IACuBa,oBAAAA,aAAO;IAA9B,yBAAuB;;;SAAkBb,OAAC;;;;IAA1C","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/input.sdsdev b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/input.sdsdev index 9e137b518..d983432e5 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/input.sdsdev +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/member access/input.sdsdev @@ -11,7 +11,7 @@ class C() { @PythonName("c") attr b: Int @Pure - @PythonCall("$param.i($this)") + @PythonMacro("$param.i($this)") fun i(param: Any?) -> result: Boolean @Pure @@ -21,7 +21,7 @@ class C() { @PythonName("k2") fun k(param: Any?) -> result: Boolean @Pure - @PythonCall("$param.i()") + @PythonMacro("$param.i()") static fun l(param: Any?) -> result: Boolean @Pure diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/this/generated/tests/generator/runnerIntegration/expressions/this/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/this/generated/tests/generator/runnerIntegration/expressions/this/gen_input.py index 1090e787e..e845d01dd 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/this/generated/tests/generator/runnerIntegration/expressions/this/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/this/generated/tests/generator/runnerIntegration/expressions/this/gen_input.py @@ -13,11 +13,11 @@ def myPipeline(): {}, [] ) - a = safeds_runner.memoized_dynamic_call( + __gen_a = safeds_runner.memoized_dynamic_call( __gen_receiver_0, "myFunction", [], {"p": __gen_receiver_0}, [] ) - safeds_runner.save_placeholder('a', a) + safeds_runner.save_placeholder('a', __gen_a) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/this/generated/tests/generator/runnerIntegration/expressions/this/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/this/generated/tests/generator/runnerIntegration/expressions/this/gen_input.py.map index af51d051b..ca7fe86ae 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/this/generated/tests/generator/runnerIntegration/expressions/this/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/expressions/this/generated/tests/generator/runnerIntegration/expressions/this/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["mypipeline","myclass"],"mappings":"AAAA;;;;;;;AAOA,IAASA,UAAU;IACP,mBAAA;;QAAAC,OAAO;;;;;IAAf,IAAQ;;;;;;;IAAR","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["mypipeline","myclass"],"mappings":"AAAA;;;;;;;AAOA,IAASA,UAAU;IACP,mBAAA;;QAAAC,OAAO;;;;;IAAf,UAAQ;;;;;;;IAAR","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py index 1f87f8e53..091bd8433 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py @@ -7,34 +7,34 @@ def testSegment(): g() - a, _, __gen_yield_c = g() - x, _, _ = g() - f1(a) - f1(x) + __gen_a, _, __gen_yield_c = g() + __gen_x, _, _ = g() + f1(__gen_a) + f1(__gen_x) return __gen_yield_c # Pipelines -------------------------------------------------------------------- def testPipeline(): g() - a, _, _ = g() - safeds_runner.save_placeholder('a', a) - x, _, _ = g() - safeds_runner.save_placeholder('x', x) - f1(a) - f1(x) - l, m, n = g() - safeds_runner.save_placeholder('l', l) - safeds_runner.save_placeholder('m', m) - safeds_runner.save_placeholder('n', n) - f1(l) - f1(m) - f1(n) + __gen_a, _, _ = g() + safeds_runner.save_placeholder('a', __gen_a) + __gen_x, _, _ = g() + safeds_runner.save_placeholder('x', __gen_x) + f1(__gen_a) + f1(__gen_x) + __gen_l, __gen_m, __gen_n = g() + safeds_runner.save_placeholder('l', __gen_l) + safeds_runner.save_placeholder('m', __gen_m) + safeds_runner.save_placeholder('n', __gen_n) + f1(__gen_l) + f1(__gen_m) + f1(__gen_n) def __gen_lambda_0(): g() - a, _, __gen_block_lambda_result_c = g() - x, _, _ = g() - f1(a) - f1(x) + __gen_a, _, __gen_block_lambda_result_c = g() + __gen_x, _, _ = g() + f1(__gen_a) + f1(__gen_x) return __gen_block_lambda_result_c f2(__gen_lambda_0) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py.map index df56226b3..35f954bd0 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/runner integration/statements/assignment/generated/tests/generator/assignmentWithRunnerIntegration/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["testsegment","g","_","c","f1","a","x","testpipeline","l","m","n","f2"],"mappings":"AAAA;;;;;;;AA2BA,IAAQA,WAAW;IACLC,CAAC;IACX,GAAOC,CAAC,EAAE,YAAMC,CAAC,GAAGF,CAAC;IACrB,UAAQA,CAAC;IACTG,EAAE,CAACC,CAAC;IACJD,EAAE,CAACE,CAAC;IALc,OAAG;;;;AApBzB,IAASC,YAAY;IACPN,CAAC;IACX,GAAOC,CAAC,EAAEA,CAAC,GAAGD,CAAC;IAAf;IACA,UAAQA,CAAC;IAAT;IACAG,EAAE,CAACC,CAAC;IACJD,EAAE,CAACE,CAAC;IACJ,GAAO,GAAO,IAAQL,CAAC;IAAvB;IAAO;IAAO;IACdG,EAAE,CAACI,CAAC;IACJJ,EAAE,CAACK,CAAC;IACJL,EAAE,CAACM,CAAC;IAED;QACWT,CAAC;QACX,GAAOC,CAAC,EAAE,0BAAMC,CAAC,GAAGF,CAAC;QACrB,UAAQA,CAAC;QACTG,EAAE,CAACC,CAAC;QACJD,EAAE,CAACE,CAAC;QALL,OAEW,0BAAMH,CAAC;IAFrBQ,EAAE,CAAC","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["testsegment","g","_","c","f1","a","x","testpipeline","l","m","n","f2"],"mappings":"AAAA;;;;;;;AA2BA,IAAQA,WAAW;IACLC,CAAC;IACX,SAAOC,CAAC,EAAE,YAAMC,CAAC,GAAGF,CAAC;IACrB,gBAAQA,CAAC;IACTG,EAAE,CAACC,OAAC;IACJD,EAAE,CAACE,OAAC;IALc,OAAG;;;;AApBzB,IAASC,YAAY;IACPN,CAAC;IACX,SAAOC,CAAC,EAAEA,CAAC,GAAGD,CAAC;IAAf;IACA,gBAAQA,CAAC;IAAT;IACAG,EAAE,CAACC,OAAC;IACJD,EAAE,CAACE,OAAC;IACJ,SAAO,SAAO,UAAQL,CAAC;IAAvB;IAAO;IAAO;IACdG,EAAE,CAACI,OAAC;IACJJ,EAAE,CAACK,OAAC;IACJL,EAAE,CAACM,OAAC;IAED;QACWT,CAAC;QACX,SAAOC,CAAC,EAAE,0BAAMC,CAAC,GAAGF,CAAC;QACrB,gBAAQA,CAAC;QACTG,EAAE,CAACC,OAAC;QACJD,EAAE,CAACE,OAAC;QALL,OAEW,0BAAMH,CAAC;IAFrBQ,EAAE,CAAC","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/main/generated/tests/generator/assignment/main/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/main/generated/tests/generator/assignment/main/gen_input.py index 1388f46d8..7ba4db02b 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/main/generated/tests/generator/assignment/main/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/main/generated/tests/generator/assignment/main/gen_input.py @@ -6,29 +6,29 @@ def testSegment(): g() - a, _, __gen_yield_c = g() - x, _, _ = g() - f1(a) - f1(x) + __gen_a, _, __gen_yield_c = g() + __gen_x, _, _ = g() + f1(__gen_a) + f1(__gen_x) return __gen_yield_c # Pipelines -------------------------------------------------------------------- def testPipeline(): g() - a, _, _ = g() - x, _, _ = g() - f1(a) - f1(x) - l, m, n = g() - f1(l) - f1(m) - f1(n) + __gen_a, _, _ = g() + __gen_x, _, _ = g() + f1(__gen_a) + f1(__gen_x) + __gen_l, __gen_m, __gen_n = g() + f1(__gen_l) + f1(__gen_m) + f1(__gen_n) def __gen_lambda_0(): g() - a, _, __gen_block_lambda_result_c = g() - x, _, _ = g() - f1(a) - f1(x) + __gen_a, _, __gen_block_lambda_result_c = g() + __gen_x, _, _ = g() + f1(__gen_a) + f1(__gen_x) return __gen_block_lambda_result_c f2(__gen_lambda_0) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/main/generated/tests/generator/assignment/main/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/main/generated/tests/generator/assignment/main/gen_input.py.map index 3d489c78f..5cea56bc5 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/main/generated/tests/generator/assignment/main/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/main/generated/tests/generator/assignment/main/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["testsegment","g","_","c","f1","a","x","testpipeline","l","m","n","f2"],"mappings":"AAAA;;;;;;AA2BA,IAAQA,WAAW;IACLC,CAAC;IACX,GAAOC,CAAC,EAAE,YAAMC,CAAC,GAAGF,CAAC;IACrB,UAAQA,CAAC;IACTG,EAAE,CAACC,CAAC;IACJD,EAAE,CAACE,CAAC;IALc,OAAG;;;;AApBzB,IAASC,YAAY;IACPN,CAAC;IACX,GAAOC,CAAC,EAAEA,CAAC,GAAGD,CAAC;IACf,UAAQA,CAAC;IACTG,EAAE,CAACC,CAAC;IACJD,EAAE,CAACE,CAAC;IACJ,GAAO,GAAO,IAAQL,CAAC;IACvBG,EAAE,CAACI,CAAC;IACJJ,EAAE,CAACK,CAAC;IACJL,EAAE,CAACM,CAAC;IAED;QACWT,CAAC;QACX,GAAOC,CAAC,EAAE,0BAAMC,CAAC,GAAGF,CAAC;QACrB,UAAQA,CAAC;QACTG,EAAE,CAACC,CAAC;QACJD,EAAE,CAACE,CAAC;QALL,OAEW,0BAAMH,CAAC;IAFrBQ,EAAE,CAAC","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["testsegment","g","_","c","f1","a","x","testpipeline","l","m","n","f2"],"mappings":"AAAA;;;;;;AA2BA,IAAQA,WAAW;IACLC,CAAC;IACX,SAAOC,CAAC,EAAE,YAAMC,CAAC,GAAGF,CAAC;IACrB,gBAAQA,CAAC;IACTG,EAAE,CAACC,OAAC;IACJD,EAAE,CAACE,OAAC;IALc,OAAG;;;;AApBzB,IAASC,YAAY;IACPN,CAAC;IACX,SAAOC,CAAC,EAAEA,CAAC,GAAGD,CAAC;IACf,gBAAQA,CAAC;IACTG,EAAE,CAACC,OAAC;IACJD,EAAE,CAACE,OAAC;IACJ,SAAO,SAAO,UAAQL,CAAC;IACvBG,EAAE,CAACI,OAAC;IACJJ,EAAE,CAACK,OAAC;IACJL,EAAE,CAACM,OAAC;IAED;QACWT,CAAC;QACX,SAAOC,CAAC,EAAE,0BAAMC,CAAC,GAAGF,CAAC;QACrB,gBAAQA,CAAC;QACTG,EAAE,CAACC,OAAC;QACJD,EAAE,CAACE,OAAC;QALL,OAEW,0BAAMH,CAAC;IAFrBQ,EAAE,CAAC","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is class call/generated/tests/generator/assignment/rhsIsClassCall/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is class call/generated/tests/generator/assignment/rhsIsClassCall/gen_input.py index 5020b6ce2..deb3215ed 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is class call/generated/tests/generator/assignment/rhsIsClassCall/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is class call/generated/tests/generator/assignment/rhsIsClassCall/gen_input.py @@ -5,4 +5,4 @@ # Pipelines -------------------------------------------------------------------- def testPipeline(): - a = MyClass1() + __gen_a = MyClass1() diff --git a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is class call/generated/tests/generator/assignment/rhsIsClassCall/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is class call/generated/tests/generator/assignment/rhsIsClassCall/gen_input.py.map index 4fdda6580..a2b21e3b3 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is class call/generated/tests/generator/assignment/rhsIsClassCall/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is class call/generated/tests/generator/assignment/rhsIsClassCall/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","myclass1"],"mappings":"AAEA;;;;;;AAIA,IAASA,YAAY;IACjB,IAAQC,QAAQ","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","myclass1"],"mappings":"AAEA;;;;;;AAIA,IAASA,YAAY;IACjB,UAAQC,QAAQ","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is enum variant call/generated/tests/generator/assignment/rhsIsEnumVariantCall/gen_input.py b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is enum variant call/generated/tests/generator/assignment/rhsIsEnumVariantCall/gen_input.py index 61b69f143..e28b600d0 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is enum variant call/generated/tests/generator/assignment/rhsIsEnumVariantCall/gen_input.py +++ b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is enum variant call/generated/tests/generator/assignment/rhsIsEnumVariantCall/gen_input.py @@ -5,4 +5,4 @@ # Pipelines -------------------------------------------------------------------- def testPipeline(): - a = MyEnum1.MyEnumVariant1(1) + __gen_a = MyEnum1.MyEnumVariant1(1) diff --git a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is enum variant call/generated/tests/generator/assignment/rhsIsEnumVariantCall/gen_input.py.map b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is enum variant call/generated/tests/generator/assignment/rhsIsEnumVariantCall/gen_input.py.map index 758181cbf..323f7b1f0 100644 --- a/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is enum variant call/generated/tests/generator/assignment/rhsIsEnumVariantCall/gen_input.py.map +++ b/packages/safe-ds-lang/tests/resources/generation/python/statements/assignments/rhs is enum variant call/generated/tests/generator/assignment/rhsIsEnumVariantCall/gen_input.py.map @@ -1 +1 @@ -{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","myenum1","myenumvariant1"],"mappings":"AAEA;;;;;;AAMA,IAASA,YAAY;IACjB,IAAQC,OAAO,CAACC,cAAc,CAAC,CAAC","file":"gen_input.py"} \ No newline at end of file +{"version":3,"sources":["input.sdsdev"],"names":["testpipeline","myenum1","myenumvariant1"],"mappings":"AAEA;;;;;;AAMA,IAASA,YAAY;IACjB,UAAQC,OAAO,CAACC,cAAc,CAAC,CAAC","file":"gen_input.py"} \ No newline at end of file diff --git a/packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonCall/main.sdsdev b/packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonMacro/main.sdsdev similarity index 61% rename from packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonCall/main.sdsdev rename to packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonMacro/main.sdsdev index 12229f767..65d89fce2 100644 --- a/packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonCall/main.sdsdev +++ b/packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonMacro/main.sdsdev @@ -1,35 +1,39 @@ -package tests.validation.builtins.pythonCall +package tests.validation.builtins.pythonMacro class MyClass { // $TEST$ no error r"The template expressions? .* cannot be interpreted." - @»PythonCall«("myMethod1($param)") + @»PythonMacro«("myMethod1($param)") fun myMethod1(param: Int) // $TEST$ no error r"The template expressions? .* cannot be interpreted." - @»PythonCall«("myMethod2($this)") + @»PythonMacro«("myMethod2($this)") fun myMethod2(`this`: Int) // $TEST$ no error "The template expression '$this' cannot be interpreted." - @»PythonCall«("myMethod3($this)") + @»PythonMacro«("myMethod3($this)") fun myMethod3() // $TEST$ error "The template expressions '$param1', '$param2' cannot be interpreted." - @»PythonCall«("myMethod4($param1, $param2)") + @»PythonMacro«("myMethod4($param1, $param2)") fun myMethod4() + + // $TEST$ error r"The template expressions? .* cannot be interpreted." + @»PythonMacro«("myMethod2($this)") + static fun myMethod5() } // $TEST$ no error r"The template expressions? .* cannot be interpreted." -@»PythonCall«("myFunction1($param)") +@»PythonMacro«("myFunction1($param)") fun myFunction1(param: Int) // $TEST$ no error r"The template expressions? .* cannot be interpreted." -@»PythonCall«("myFunction2($this)") +@»PythonMacro«("myFunction2($this)") fun myFunction2(`this`: Int) // $TEST$ error "The template expression '$this' cannot be interpreted." -@»PythonCall«("myFunction3($this)") +@»PythonMacro«("myFunction3($this)") fun myFunction3() // $TEST$ error "The template expressions '$param1', '$param2' cannot be interpreted." -@»PythonCall«("myFunction4($param1, $param2)") +@»PythonMacro«("myFunction4($param1, $param2)") fun myFunction4() diff --git a/packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonName/mutually exclusive with python call/main.sdsdev b/packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonName/mutually exclusive with python call/main.sdsdev index 23901ea2a..d9ca262a7 100644 --- a/packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonName/mutually exclusive with python call/main.sdsdev +++ b/packages/safe-ds-lang/tests/resources/validation/builtins/annotations/pythonName/mutually exclusive with python call/main.sdsdev @@ -1,6 +1,6 @@ -package tests.validation.builtins.annotations.pythonName.mutuallyExclusiveWithPythonCall +package tests.validation.builtins.annotations.pythonName.mutuallyExclusiveWithPythonMacro -@PythonCall("myFunction1()") +@PythonMacro("myFunction1()") // $TEST$ error "A Python name must not be set if a Python call is set." @»PythonName«("my_function_1") // $TEST$ no error "A Python name must not be set if a Python call is set." @@ -11,7 +11,7 @@ fun myFunction1() @»PythonName«("my_function_2") // $TEST$ no error "A Python name must not be set if a Python call is set." @»PythonName«("my_function_2") -@PythonCall("myFunction2()") +@PythonMacro("myFunction2()") fun myFunction2() // $TEST$ no error "A Python name must not be set if a Python call is set." @@ -22,5 +22,5 @@ fun myFunction3() @»PythonName«("my_function_2") // $TEST$ no error "A Python name must not be set if a Python call is set." @»PythonName«("my_function_2") -@PythonCall("myFunction2()") +@PythonMacro("myFunction2()") class MyClass() diff --git a/packages/safe-ds-lang/tests/resources/validation/inheritance/must not override method with python call annotation/main.sdsdev b/packages/safe-ds-lang/tests/resources/validation/inheritance/must not override method with python call annotation/main.sdsdev index 7a7f251aa..790ff432b 100644 --- a/packages/safe-ds-lang/tests/resources/validation/inheritance/must not override method with python call annotation/main.sdsdev +++ b/packages/safe-ds-lang/tests/resources/validation/inheritance/must not override method with python call annotation/main.sdsdev @@ -1,36 +1,36 @@ -package tests.validation.inheritance.mustNotOverrideMethodWithPythonCallAnnotation +package tests.validation.inheritance.mustNotOverrideMethodWithPythonMacroAnnotation class MyClass1 { attr myAttribute: Int - // $TEST$ no error "Cannot override a method that calls the '@PythonCall' annotation." + // $TEST$ no error "Cannot override a method that calls the '@PythonMacro' annotation." @Pure - @PythonCall("some_other_function") - fun »withPythonCall«() + @PythonMacro("some_other_function") + fun »withPythonMacro«() - // $TEST$ no error "Cannot override a method that calls the '@PythonCall' annotation." + // $TEST$ no error "Cannot override a method that calls the '@PythonMacro' annotation." @Pure - fun »withoutPythonCall«() + fun »withoutPythonMacro«() } class MyClass2 sub MyClass1 { - // $TEST$ no error "Cannot override a method that calls the '@PythonCall' annotation." + // $TEST$ no error "Cannot override a method that calls the '@PythonMacro' annotation." @Pure - @PythonCall("some_other_function") - fun »withPythonCall«() + @PythonMacro("some_other_function") + fun »withPythonMacro«() - // $TEST$ no error "Cannot override a method that calls the '@PythonCall' annotation." + // $TEST$ no error "Cannot override a method that calls the '@PythonMacro' annotation." @Pure - @PythonCall("some_other_function") - fun »withoutPythonCall«() + @PythonMacro("some_other_function") + fun »withoutPythonMacro«() } class MyClass3 sub MyClass1 { - // $TEST$ no error "Cannot override a method that calls the '@PythonCall' annotation." + // $TEST$ no error "Cannot override a method that calls the '@PythonMacro' annotation." @Pure fun »myAttribute«() - // $TEST$ error "Cannot override a method that calls the '@PythonCall' annotation." + // $TEST$ error "Cannot override a method that calls the '@PythonMacro' annotation." @Pure - fun »withPythonCall«() + fun »withPythonMacro«() } diff --git a/packages/safe-ds-lang/tests/resources/validation/inheritance/must not override method with python call annotation/safeds lang any.sdsdev b/packages/safe-ds-lang/tests/resources/validation/inheritance/must not override method with python call annotation/safeds lang any.sdsdev index e6d2feed0..d7fd01543 100644 --- a/packages/safe-ds-lang/tests/resources/validation/inheritance/must not override method with python call annotation/safeds lang any.sdsdev +++ b/packages/safe-ds-lang/tests/resources/validation/inheritance/must not override method with python call annotation/safeds lang any.sdsdev @@ -1,6 +1,6 @@ package safeds.lang class Any { - // $TEST$ no error "Cannot override a method that calls the '@PythonCall' annotation." + // $TEST$ no error "Cannot override a method that calls the '@PythonMacro' annotation." fun »toString«() -> s: String } diff --git a/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method must not have python call annotation/main.sdsdev b/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method must not have python call annotation/main.sdsdev index 7572635af..7ce7e84c3 100644 --- a/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method must not have python call annotation/main.sdsdev +++ b/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method must not have python call annotation/main.sdsdev @@ -1,24 +1,24 @@ -package tests.validation.inheritance.overridingMethodMustNotHavePythonCallAnnotation +package tests.validation.inheritance.overridingMethodMustNotHavePythonMacroAnnotation class MyClass1 { - // $TEST$ no error "An overriding method must not call the '@PythonCall' annotation." + // $TEST$ no error "An overriding method must not call the '@PythonMacro' annotation." @Pure - @PythonCall("some_other_function") - fun »withPythonCall«() + @PythonMacro("some_other_function") + fun »withPythonMacro«() - // $TEST$ no error "An overriding method must not call the '@PythonCall' annotation." + // $TEST$ no error "An overriding method must not call the '@PythonMacro' annotation." @Pure - fun »withoutPythonCall«() + fun »withoutPythonMacro«() } class MyClass2 sub MyClass1 { - // $TEST$ error "An overriding method must not call the '@PythonCall' annotation." + // $TEST$ error "An overriding method must not call the '@PythonMacro' annotation." @Pure - @PythonCall("some_other_function") - fun »withPythonCall«() + @PythonMacro("some_other_function") + fun »withPythonMacro«() - // $TEST$ error "An overriding method must not call the '@PythonCall' annotation." + // $TEST$ error "An overriding method must not call the '@PythonMacro' annotation." @Pure - @PythonCall("some_other_function") - fun »withoutPythonCall«() + @PythonMacro("some_other_function") + fun »withoutPythonMacro«() } diff --git a/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method must not have python call annotation/safeds lang any.sdsdev b/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method must not have python call annotation/safeds lang any.sdsdev index e839f2767..b175aa51e 100644 --- a/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method must not have python call annotation/safeds lang any.sdsdev +++ b/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method must not have python call annotation/safeds lang any.sdsdev @@ -1,7 +1,7 @@ package safeds.lang class Any { - // $TEST$ no error "An overriding method must not call the '@PythonCall' annotation." - @PythonCall("str($this)") + // $TEST$ no error "An overriding method must not call the '@PythonMacro' annotation." + @PythonMacro("str($this)") fun »toString«() -> s: String } diff --git a/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method should differ from overridden method/with python call.sdsdev b/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method should differ from overridden method/with python macro.sdsdev similarity index 80% rename from packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method should differ from overridden method/with python call.sdsdev rename to packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method should differ from overridden method/with python macro.sdsdev index 909a88fb3..1e6d11f43 100644 --- a/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method should differ from overridden method/with python call.sdsdev +++ b/packages/safe-ds-lang/tests/resources/validation/inheritance/overriding method should differ from overridden method/with python macro.sdsdev @@ -1,4 +1,4 @@ -package tests.validation.inheritance.overridingMethodShouldDifferFromOverriddenMethod.withPythonCall +package tests.validation.inheritance.overridingMethodShouldDifferFromOverriddenMethod.withPythonMacro class MyClass1 { @Pure @@ -8,6 +8,6 @@ class MyClass1 { class MyClass2 { // $TEST$ no info "Overriding member is identical to overridden member and can be removed." @Pure - @PythonCall("") + @PythonMacro("") fun »f«() }