-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorrect subscript resolution #1519
- Loading branch information
Showing
10 changed files
with
78 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
fn void test(int* array, usz n) | ||
{ | ||
array[n] = 33; | ||
n[array] = 33; // #error: Cannot index | ||
n[array] = 33; // #error: Indexing a value of type | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// #target: macos-x64 | ||
fn void test() | ||
{ | ||
int[3] x = { 1, 2, 3 }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
// #target: macos-x64 | ||
fn void test() | ||
{ | ||
int[3] x = { 1, 2, 3 }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// #target: macos-x64 | ||
fn void test() | ||
{ | ||
int[3] x = { 1, 2, 3 }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// #target: macos-x64 | ||
fn void test() | ||
{ | ||
int[3] x = { 1, 2, 3 }; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// #target: macos-x64 | ||
module test; | ||
import std::collections::list; | ||
macro @test_list(a) | ||
{ | ||
var $Type = $typeof(a); | ||
$if $defined(a[0]) &&& $Type.typeid == List(<$typeof(a[0])>).typeid: | ||
return 1; | ||
$else | ||
return 0; | ||
$endif | ||
} | ||
|
||
fn int main(String[] args) | ||
{ | ||
DString str = dstring::new("test"); | ||
return @test_list(str); | ||
} | ||
|
||
/* #expect: test.ll | ||
|
||
define i32 @test.main(ptr %0, i64 %1) #0 { | ||
entry: | ||
%args = alloca %"char[][]", align 8 | ||
%str = alloca ptr, align 8 | ||
%a = alloca ptr, align 8 | ||
store ptr %0, ptr %args, align 8 | ||
%ptradd = getelementptr inbounds i8, ptr %args, i64 8 | ||
store i64 %1, ptr %ptradd, align 8 | ||
%lo = load i64, ptr @std.core.mem.allocator.thread_allocator, align 8 | ||
%hi = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.allocator.thread_allocator, i64 8), align 8 | ||
%2 = call ptr @std.core.dstring.new(ptr @.str, i64 4, i64 %lo, ptr %hi) | ||
store ptr %2, ptr %str, align 8 | ||
%3 = load ptr, ptr %str, align 8 | ||
store ptr %3, ptr %a, align 8 | ||
ret i32 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters