You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: test/fail_compilation/previewin.d
+17-43
Original file line number
Diff line number
Diff line change
@@ -2,59 +2,33 @@
2
2
REQUIRED_ARGS: -preview=in -preview=dip1000
3
3
TEST_OUTPUT:
4
4
---
5
-
fail_compilation/previewin.d(3): Error: function `previewin.func1(void function(ulong[8]) dg)` is not callable using argument types `(void function(in ulong[8]))`
6
-
fail_compilation/previewin.d(3): cannot pass argument `& func_byRef` of type `void function(in ulong[8])` to parameter `void function(ulong[8]) dg`
7
-
fail_compilation/previewin.d(4): Error: function `previewin.func2(void function(ref ulong[8]) dg)` is not callable using argument types `(void function(in ulong[8]))`
8
-
fail_compilation/previewin.d(4): cannot pass argument `& func_byRef` of type `void function(in ulong[8])` to parameter `void function(ref ulong[8]) dg`
9
-
fail_compilation/previewin.d(7): Error: function `previewin.func4(void function(ref uint) dg)` is not callable using argument types `(void function(in uint))`
10
-
fail_compilation/previewin.d(7): cannot pass argument `& func_byValue` of type `void function(in uint)` to parameter `void function(ref uint) dg`
11
-
fail_compilation/previewin.d(41): Error: scope variable `arg` assigned to non-scope `myGlobal`
12
-
fail_compilation/previewin.d(42): Error: scope variable `arg` assigned to non-scope `myGlobal`
13
-
fail_compilation/previewin.d(43): Error: scope variable `arg` may not be returned
14
-
fail_compilation/previewin.d(44): Error: scope variable `arg` assigned to `escape` with longer lifetime
15
-
fail_compilation/previewin.d(48): Error: returning `arg` escapes a reference to parameter `arg`
16
-
fail_compilation/previewin.d(48): perhaps annotate the parameter with `return`
5
+
fail_compilation/previewin.d(4): Error: function `previewin.takeFunction(void function(in real) f)` is not callable using argument types `(void function(real x) pure nothrow @nogc @safe)`
6
+
fail_compilation/previewin.d(4): cannot pass argument `__lambda1` of type `void function(real x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
7
+
fail_compilation/previewin.d(5): Error: function `previewin.takeFunction(void function(in real) f)` is not callable using argument types `(void function(const(real) x) pure nothrow @nogc @safe)`
8
+
fail_compilation/previewin.d(5): cannot pass argument `__lambda2` of type `void function(const(real) x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
9
+
fail_compilation/previewin.d(6): Error: function `previewin.takeFunction(void function(in real) f)` is not callable using argument types `(void function(ref const(real) x) pure nothrow @nogc @safe)`
10
+
fail_compilation/previewin.d(6): cannot pass argument `__lambda3` of type `void function(ref const(real) x) pure nothrow @nogc @safe` to parameter `void function(in real) f`
11
+
fail_compilation/previewin.d(15): Error: scope variable `arg` assigned to non-scope `myGlobal`
12
+
fail_compilation/previewin.d(16): Error: scope variable `arg` assigned to non-scope `myGlobal`
13
+
fail_compilation/previewin.d(17): Error: scope variable `arg` may not be returned
14
+
fail_compilation/previewin.d(18): Error: scope variable `arg` assigned to `escape` with longer lifetime
15
+
fail_compilation/previewin.d(22): Error: returning `arg` escapes a reference to parameter `arg`
16
+
fail_compilation/previewin.d(22): perhaps annotate the parameter with `return`
17
17
---
18
18
*/
19
19
20
20
#line1
21
21
voidmain ()
22
22
{
23
-
func1(&func_byRef); // No
24
-
func2(&func_byRef); // No
25
-
func3(&func_byRef); // Could be Yes, but currently No
26
-
27
-
func4(&func_byValue); // No
28
-
func5(&func_byValue); // Yes
29
-
30
-
func6(&func_byValue2); // Yes
31
-
func7(&func_byValue3); // Yes
23
+
// No covariance without explicit `in`
24
+
takeFunction((real x) {});
25
+
takeFunction((constscopereal x) {});
26
+
takeFunction((constscoperefreal x) {});
32
27
33
28
tryEscape("Hello World"); // Yes by `tryEscape` is NG
0 commit comments