Last change
on this file since 409bb8f was f02f546, checked in by Michael Brooks <mlbrooks@…>, 2 years ago |
Implement new rules for array dimension expression matching.
Core changes:
src/ResolvExpr/Unify.cc: add sense of "these two expressions unify"
src/InitTweak/GenInit.cc: make hoisting happen more often
tests/array-container/*: reconfigure the array-dimension test to use non-"classic" expectation rules
Misc contributors and noise:
libcfa/src/parseargs.cfa: ,ake a parameter, that's used as a length expression, constant (example of an array user following new rules)
src/ResolvExpr/ResolveTypeof.h: make fixArrayType public
src/Validate/GenericParameter.cpp: do the array-type desugaring in both AST corners that forall-variables can be found (not just in one of them)
tests/.expect/typedefRedef-ERR1.txt: old one was "expecting" a bug, that new array rules handle correctly
|
-
Property mode
set to
100644
|
File size:
562 bytes
|
Line | |
---|
1 | // A simple, isolated, example of what the dimexpr-match cases are all about.
|
---|
2 |
|
---|
3 | #include <containers/array.hfa>
|
---|
4 |
|
---|
5 | // context excerpted from doc/theses/mike_brooks_MMath/programs/hello-array.cfa
|
---|
6 | forall( [N] )
|
---|
7 | array(bool, N) & f( array(float, N) & a, array(float, N) & b ) {}
|
---|
8 |
|
---|
9 | int main() {
|
---|
10 | // adapted from Peter's "why doesn't this one work" email
|
---|
11 | array(float, 10) a;
|
---|
12 | array(float, 20) b;
|
---|
13 | f( a, a ); // these calls ok (no error here; actual success is shown in dimexpr-match)
|
---|
14 | f( b, b );
|
---|
15 |
|
---|
16 | f( a, b ); // reject with mismatch
|
---|
17 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.