Skip to content

Commit

Permalink
[compiler][analysis][W0001] Compute the set of process entry points o…
Browse files Browse the repository at this point in the history
…f a program, and generate an error if private process is an entry point.
  • Loading branch information
ptal committed Jul 23, 2018
1 parent 9fb8cf6 commit 975858b
Show file tree
Hide file tree
Showing 39 changed files with 278 additions and 142 deletions.
4 changes: 2 additions & 2 deletions data/test/compile-fail/E0001.bonsai.java
Expand Up @@ -13,12 +13,12 @@
// limitations under the License.

#[error(E0001, 22, 9)]
#[error(E0001, 23, 23)]
#[error(E0001, 23, 30)]

package test;

public class CannotFindModule
{
module Unknown2 unknown2;
proc test() = module NotFound notFound;
public proc test() = module NotFound notFound;
}
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0002.bonsai.java
Expand Up @@ -21,5 +21,5 @@ public class DuplicateAttribute
single_time Dup d;
single_time Dup d;

proc test() = nothing
public proc test() = nothing
}
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0003_1.bonsai.java
Expand Up @@ -18,7 +18,7 @@

public class DuplicateVar
{
proc test() =
public proc test() =
single_time Dup d;
single_time Dup d;
end
Expand Down
4 changes: 2 additions & 2 deletions data/test/compile-fail/E0003_2.bonsai.java
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[error(E0003, 23, 32)]
#[error(E0003, 23, 39)]

package test;

public class DuplicateAttributeVar
{
single_time Dup d;

proc test() = single_time Dup d
public proc test() = single_time Dup d
}
8 changes: 4 additions & 4 deletions data/test/compile-fail/E0003_3.bonsai.java
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[error(E0003, 24, 33)]
#[error(E0003, 25, 33)]
#[error(E0003, 24, 40)]
#[error(E0003, 25, 40)]

package test;

public class TwoDuplicateVar
{
single_time Dup d;

proc test1() = single_time Dup d
proc test2() = single_time Dup d
public proc test1() = single_time Dup d
public proc test2() = single_time Dup d
}
14 changes: 7 additions & 7 deletions data/test/compile-fail/E0004.bonsai.java
Expand Up @@ -12,17 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[error(E0004, 24, 7)]
#[error(E0004, 27, 7)]
#[error(E0004, 24, 14)]
#[error(E0004, 27, 14)]

package test;

public class DuplicateProc
{
proc unique1() = nothing
proc dup() = nothing
proc dup() = nothing
public proc unique1() = nothing
public proc dup() = nothing
public proc dup() = nothing

proc unique2() = nothing
proc dup() = nothing
public proc unique2() = nothing
public proc dup() = nothing
}
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0005.bonsai.java
Expand Up @@ -25,5 +25,5 @@ public class FieldInitializationWithRef

public FieldInitializationWithRef(T a) {}

proc test() = nothing
public proc test() = nothing
}
6 changes: 3 additions & 3 deletions data/test/compile-fail/E0006_1.bonsai.java
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#[error(E0006, 24, 28)]
#[error(E0006, 32, 36)]
#[error(E0006, 32, 43)]

package test;
import java.lang.System;
Expand All @@ -24,10 +24,10 @@ public class UndeclaredVariable
single_space T t2 = new T(t3);
single_space T t3 = new T();

proc test() =
public proc test() =
single_space T t4 = new T();
System.out.println(t4);
end

proc test2() = System.out.println(t4)
public proc test2() = System.out.println(t4)
}
4 changes: 2 additions & 2 deletions data/test/compile-fail/E0007.bonsai.java
Expand Up @@ -18,10 +18,10 @@

public class UndeclaredProcess
{
proc test() =
public proc test() =
run test1();
run test2();
end

proc test1() = nothing
public proc test1() = nothing
}
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0008.bonsai.java
Expand Up @@ -23,7 +23,7 @@ public class UnknownField
{
module Module m = new Module();

proc test() =
public proc test() =
m.a;
m.c;
J.inside_args(m.d, m.a);
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0009.bonsai.java
Expand Up @@ -21,7 +21,7 @@ public class UnknownProcess
{
module Module m = new Module();

proc test() =
public proc test() =
run m.test();
run m.wrong();
run m.b.test();
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0010.bonsai.java
Expand Up @@ -21,7 +21,7 @@ public class ForeignProcessCall
{
module Module m = new Module();

proc test() =
public proc test() =
run m.test();
run m.a.foreign();
run m.b.a.foreign();
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0013.bonsai.java
Expand Up @@ -22,5 +22,5 @@ public class MissingConstructor
single_space N b;
ref single_space T ok;

proc missing_constructor() = nothing
public proc missing_constructor() = nothing
}
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0016.bonsai.java
Expand Up @@ -27,7 +27,7 @@ public ForbiddenWriteOnPre(T a) {
this.a = a;
}

proc test() =
public proc test() =
world_line N b;
pre a <- 1;
pre b <- 2;
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0017.bonsai.java
Expand Up @@ -30,7 +30,7 @@ public PreOnlyOnStream(T a) {
this.a = a;
}

proc test() =
public proc test() =
single_time N b;
ok <- pre b;
ok <- pre m;
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0018.bonsai.java
Expand Up @@ -23,7 +23,7 @@ public class IllegalLocalModuleInitializer
{
public single_space T a;

proc test() =
public proc test() =
module Module ok3 = new Module();
module Module2 ko3 = Module2.create();
module Module2 ko4 = bot;
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0019.bonsai.java
Expand Up @@ -21,7 +21,7 @@ public class MissingModuleInitializer
{
public single_space T a;

proc test() =
public proc test() =
module Module ok3 = new Module();
module Module2 ko1;
module Module ko2;
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0021.bonsai.java
Expand Up @@ -29,5 +29,5 @@ public class ModuleRefFieldInitializer
public module Module2 ko1 = new Module2(a);
public module Module2 ko2 = Module2.create(a);

proc test() = nothing
public proc test() = nothing
}
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0022.bonsai.java
Expand Up @@ -23,7 +23,7 @@ public class ModuleRefInitializer
{
public single_space T a;

proc test() =
public proc test() =
module Module2 ok1 = new Module2(a);
module Module2 ko1 = new Module2(new T());
module Module2 ko2 = new Module2(J.make());
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0023.bonsai.java
Expand Up @@ -25,7 +25,7 @@ public class ModuleParameterMismatch
public single_time T c;
public module Module d;

proc test() =
public proc test() =
module Module2 ok1 = new Module2(a);
module Module2 ko1 = new Module2(b);
module Module2 ko2 = new Module2(c);
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0024.bonsai.java
Expand Up @@ -22,7 +22,7 @@ public class ModuleParameterMismatch
public single_space T a;
public single_space T b;

proc test() =
public proc test() =
module Module2 ko1 = new Module2(a, b);
module Module2 ko2 = new Module2();
end
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0025.bonsai.java
Expand Up @@ -22,7 +22,7 @@ public class ForbiddenHostLocalVariable
public T ok;
public single_space T b;

proc test() =
public proc test() =
T ko = new T();
single_space T ok2 = new T();
when ok2 |= ok2 then
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0026.bonsai.java
Expand Up @@ -26,7 +26,7 @@ public class IllegalPermissionInContext
public single_space LMax a;
public single_space LMax b;

proc test() =
public proc test() =
write a <- 1; // OK
a <- 2; // OK
read a <- 3; // KO
Expand Down
2 changes: 1 addition & 1 deletion data/test/compile-fail/E0027.bonsai.java
Expand Up @@ -27,7 +27,7 @@ public class IllegalHostFunctionInReadContext
public single_space LMax b;
public ES t;

proc test() =
public proc test() =
t <- a |= b; // OK
t <- f(a) |= b; // KO
t <- a |= f(b); // KO
Expand Down
24 changes: 12 additions & 12 deletions data/test/compile-fail/E0028.bonsai.java
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#[error(E0028, 34, 20)]
#[error(E0028, 34, 27)]
#[error(E0028, 37, 4)]
#[error(E0028, 42, 4)]
#[error(E0028, 52, 4)]
Expand All @@ -31,14 +31,14 @@ public class E0028 // InstantaneousLoop
public single_space LMax a;
public single_space LMax b;

proc test_ko1() = loop nothing end
public proc test_ko1() = loop nothing end

proc test_ko2() =
public proc test_ko2() =
loop
when a |= b then nothing end
end

proc test_ko3() =
public proc test_ko3() =
loop
when a |= b then
nothing
Expand All @@ -48,21 +48,21 @@ proc test_ko3() =
a <- f(a)
end

proc test_ko4() =
public proc test_ko4() =
loop
suspend when a |= b in
nothing
end
end

proc test_ko5() =
public proc test_ko5() =
loop
abort when a |= b in
pause
end
end

proc test_ko6() =
public proc test_ko6() =
loop
when a |= b then
suspend when a |= b in
Expand All @@ -73,7 +73,7 @@ proc test_ko6() =
end
end

proc test_ko7() =
public proc test_ko7() =
loop
abort when a |= b in
loop
Expand All @@ -83,7 +83,7 @@ proc test_ko7() =
pause
end

proc test_ko8() =
public proc test_ko8() =
loop
abort when a |= b in
loop
Expand All @@ -92,17 +92,17 @@ proc test_ko8() =
end
end

proc test1() =
public proc test1() =
abort when a |= b in
pause
end

proc test_ko9() =
public proc test_ko9() =
loop
run test1();
end

proc test_ko10() =
public proc test_ko10() =
loop
par
|| run test1()
Expand Down

0 comments on commit 975858b

Please sign in to comment.