forked from chapel-lang/chapel
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test cases from issue chapel-lang#19352
--- Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
101 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Library { | ||
record rec { | ||
proc method() { writeln("Library's rec.method()"); } | ||
} | ||
} | ||
|
||
|
||
module LibraryPlus { | ||
import Library; | ||
import Library.rec; | ||
|
||
proc rec.method() { writeln("LibraryPlus's rec.method()"); } | ||
} | ||
|
||
// Case 1 | ||
module Program { | ||
import Library; | ||
proc main() { | ||
import LibraryPlus.rec; // does this make LibraryPlus.rec.method "closer" ? | ||
var r = new Library.rec(); | ||
r.method(); // currently: ambiguity error | ||
} | ||
} |
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,4 @@ | ||
issue-19352-1.chpl:18: In function 'main': | ||
issue-19352-1.chpl:21: error: ambiguous call 'rec.method()' | ||
issue-19352-1.chpl:3: note: candidates are: rec.method() | ||
issue-19352-1.chpl:12: note: rec.method() |
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,18 @@ | ||
module Library { | ||
record rec { | ||
proc method() { writeln("Library's rec.method()"); } | ||
} | ||
} | ||
|
||
// Case 2a | ||
module Program { | ||
import Library; | ||
import Library.rec; // Should this bring in the methods as if defined here? | ||
|
||
proc rec.method() { writeln("Program's rec.method()"); } | ||
|
||
proc main() { | ||
var r = new Library.rec(); | ||
r.method(); // currently outputs: Program's rec.method() | ||
} | ||
} |
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,4 @@ | ||
issue-19352-2a.chpl:14: In function 'main': | ||
issue-19352-2a.chpl:16: error: ambiguous call 'rec.method()' | ||
issue-19352-2a.chpl:3: note: candidates are: rec.method() | ||
issue-19352-2a.chpl:12: note: rec.method() |
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,18 @@ | ||
module Library { | ||
record rec { | ||
proc method() { writeln("Library's rec.method()"); } | ||
} | ||
} | ||
|
||
// Case 2b | ||
module Program { | ||
import Library; // Should this bring in the methods | ||
// on types defined in Library as if defined here? | ||
|
||
proc (Library.rec).method() { writeln("Program's rec.method()"); } | ||
|
||
proc main() { | ||
var r = new Library.rec(); | ||
r.method(); // currently outputs: Program's rec.method() | ||
} | ||
} |
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,4 @@ | ||
issue-19352-2b.chpl:14: In function 'main': | ||
issue-19352-2b.chpl:16: error: ambiguous call 'rec.method()' | ||
issue-19352-2b.chpl:3: note: candidates are: rec.method() | ||
issue-19352-2b.chpl:12: note: (Library.rec).method() |
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,26 @@ | ||
module Library { | ||
record rec { | ||
proc method() { writeln("Library's rec.method()"); } | ||
} | ||
} | ||
|
||
|
||
module LibraryPlus { | ||
import Library; | ||
import Library.rec; | ||
|
||
proc rec.method() { writeln("LibraryPlus's rec.method()"); } | ||
} | ||
|
||
// Case 3 | ||
module Program { | ||
public import Library; | ||
public use LibraryPlus; // should LibraryPlus.rec.method now shadow Library.rec.method? | ||
|
||
proc main() { | ||
var r = new Library.rec(); | ||
r.method(); // currently: | ||
// without PR #19306, ambiguity error | ||
// with PR #19306, outputs LibraryPlus's rec.method() | ||
} | ||
} |
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,4 @@ | ||
issue-19352-3.chpl:20: In function 'main': | ||
issue-19352-3.chpl:22: error: ambiguous call 'rec.method()' | ||
issue-19352-3.chpl:3: note: candidates are: rec.method() | ||
issue-19352-3.chpl:12: note: rec.method() |