-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
143 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,5 @@ | ||
# for "make clean" to work everywhere | ||
|
||
CONFDIR = $(realpath ../..) | ||
|
||
include $(CONFDIR)/clean.mk |
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,5 @@ | ||
# for "make clean" to work everywhere | ||
|
||
CONFDIR = $(realpath ../../..) | ||
|
||
include $(CONFDIR)/clean.mk |
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,5 @@ | ||
typedef "Foo" Name; | ||
|
||
function Bool isName (String x); | ||
return (Name == x); | ||
endfunction |
4 changes: 4 additions & 0 deletions
4
testsuite/bsc.bugs/github/gh276/SuggestStringOf_NoCon.bsv.bsc-out.expected
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 @@ | ||
checking package dependencies | ||
compiling SuggestStringOf_NoCon.bsv | ||
Error: "SuggestStringOf_NoCon.bsv", line 4, column 12: (T0003) | ||
Unbound constructor `Name'. Perhaps `stringOf' is missing? |
13 changes: 13 additions & 0 deletions
13
testsuite/bsc.bugs/github/gh276/SuggestStringOf_TwoCon_IntegerContext.bsv
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,13 @@ | ||
typedef union tagged { | ||
Bit#(16) DataWidth; | ||
} T1; | ||
|
||
typedef union tagged { | ||
Bit#(8) DataWidth; | ||
} T2; | ||
|
||
typedef "Foo" Name; | ||
|
||
function String getName(); | ||
return Name; | ||
endfunction |
4 changes: 4 additions & 0 deletions
4
testsuite/bsc.bugs/github/gh276/SuggestStringOf_TwoCon_IntegerContext.bsv.bsc-out.expected
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 @@ | ||
checking package dependencies | ||
compiling SuggestStringOf_TwoCon_IntegerContext.bsv | ||
Error: "SuggestStringOf_TwoCon_IntegerContext.bsv", line 12, column 11: (T0003) | ||
Unbound constructor `Name'. Perhaps `stringOf' is missing? |
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,5 @@ | ||
typedef 32 DataWidth; | ||
|
||
function Bool is64 (Bit#(8) x); | ||
return (DataWidth == 64); | ||
endfunction |
4 changes: 4 additions & 0 deletions
4
testsuite/bsc.bugs/github/gh276/SuggestValueOf_NoCon.bsv.bsc-out.expected
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 @@ | ||
checking package dependencies | ||
compiling SuggestValueOf_NoCon.bsv | ||
Error: "SuggestValueOf_NoCon.bsv", line 4, column 12: (T0003) | ||
Unbound constructor `DataWidth'. Perhaps `valueOf' is missing? |
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,9 @@ | ||
typedef union tagged { | ||
Bit#(16) DataWidth; | ||
} T1; | ||
|
||
typedef 32 DataWidth; | ||
|
||
function Integer getDataWidth(); | ||
return DataWidth; | ||
endfunction |
11 changes: 11 additions & 0 deletions
11
testsuite/bsc.bugs/github/gh276/SuggestValueOf_OneCon.bsv.bsc-out.expected
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,11 @@ | ||
checking package dependencies | ||
compiling SuggestValueOf_OneCon.bsv | ||
Error: "SuggestValueOf_OneCon.bsv", line 8, column 11: (T0144) | ||
Wrong number of arguments in the partial application of the following | ||
constructor: | ||
SuggestValueOf_OneCon::DataWidth | ||
The constructor expects 1 arguments and was used with 0 arguments, leaving 1 | ||
unfilled, however a function was not expected. | ||
The expected type is: | ||
Integer | ||
|
13 changes: 13 additions & 0 deletions
13
testsuite/bsc.bugs/github/gh276/SuggestValueOf_TwoCon_IntegerContext.bsv
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,13 @@ | ||
typedef union tagged { | ||
Bit#(16) DataWidth; | ||
} T1; | ||
|
||
typedef union tagged { | ||
Bit#(8) DataWidth; | ||
} T2; | ||
|
||
typedef 32 DataWidth; | ||
|
||
function Integer getDataWidth(); | ||
return DataWidth; | ||
endfunction |
4 changes: 4 additions & 0 deletions
4
testsuite/bsc.bugs/github/gh276/SuggestValueOf_TwoCon_IntegerContext.bsv.bsc-out.expected
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 @@ | ||
checking package dependencies | ||
compiling SuggestValueOf_TwoCon_IntegerContext.bsv | ||
Error: "SuggestValueOf_TwoCon_IntegerContext.bsv", line 12, column 11: (T0003) | ||
Unbound constructor `DataWidth'. Perhaps `valueOf' is missing? |
14 changes: 14 additions & 0 deletions
14
testsuite/bsc.bugs/github/gh276/SuggestValueOf_TwoCon_PolyContext.bsv
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,14 @@ | ||
typedef union tagged { | ||
Bit#(16) DataWidth; | ||
} T1; | ||
|
||
typedef union tagged { | ||
Bit#(8) DataWidth; | ||
} T2; | ||
|
||
typedef 32 DataWidth; | ||
|
||
function Bool is64 (Integer x); | ||
// The expected type for DataWidth is a variable because '==' is overloaded | ||
return (DataWidth == 64); | ||
endfunction |
4 changes: 4 additions & 0 deletions
4
testsuite/bsc.bugs/github/gh276/SuggestValueOf_TwoCon_PolyContext.bsv.bsc-out.expected
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 @@ | ||
checking package dependencies | ||
compiling SuggestValueOf_TwoCon_PolyContext.bsv | ||
Error: "SuggestValueOf_TwoCon_PolyContext.bsv", line 13, column 12: (T0019) | ||
Constructor `DataWidth' is not disambiguated by type `_tctyvar1004' |
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,43 @@ | ||
|
||
# GitHub Issue #276 | ||
# | ||
# Test BSC error messages when the user forgets to apply 'valueOf' | ||
# (or 'stringOf') to a type name, which BSC then interprets as a | ||
# constructor name | ||
|
||
proc do_test { filename } { | ||
compile_fail $filename | ||
compare_file [make_bsc_output_name $filename] | ||
} | ||
|
||
# If there is no constructor by the same name as the type, | ||
# BSC reports an unbound constructor error (T0003) | ||
# and adds a message suggesting 'valueOf' | ||
# | ||
do_test SuggestValueOf_NoCon.bsv | ||
do_test SuggestStringOf_NoCon.bsv | ||
|
||
# If there is one constructor by the same name as the type, | ||
# BSC assumes the user meant that one, and uses its type. | ||
# This likely results in a type mismatch error, because the | ||
# constructor expects an argument. | ||
# This message will not suggest that 'valueOf' is missing. | ||
# | ||
do_test SuggestValueOf_OneCon.bsv | ||
|
||
# If there is more than one constructor by the same name as the type, | ||
# and the context expects a concrete type, then BSC will pick the | ||
# constructor with that return type. Likely finding none, BSC will | ||
# report an unbound constructor error (T0003) and add a message | ||
# suggesting 'valueOf' | ||
# | ||
do_test SuggestValueOf_TwoCon_IntegerContext.bsv | ||
do_test SuggestStringOf_TwoCon_IntegerContext.bsv | ||
|
||
# If there is more than on constructor by the same name as the type, | ||
# but the context does not expect a concrete type (is polymorphic), | ||
# then BSC will report an unambiguous constructor error (T0019). | ||
# This message will not suggest that 'valueOf' is missing. | ||
# | ||
do_test SuggestValueOf_TwoCon_PolyContext.bsv | ||
|