Commit a4b6e13a authored by ucifm's avatar ucifm
Browse files

added semantic tests of group 5

parent 06736cad
Pipeline #177366 failed with stage
in 10 minutes and 13 seconds
/* Some assignments are not allowed. */
class Main {
public static void main(String[] args) {
new Main() = new Main();
}
}
/* Some assignments are not allowed. */
class Main {
public static void main(String[] args) {
new int[3][] = new int[3][];
}
}
/* Some assignments are not allowed. */
class Main {
public static void main(String[] args) {
int x = 0;
x + x = 1;
}
}
/* Some assignments are not allowed. */
class Main {
public static void main(String[] args) {
int x = 0;
-x = 1;
}
}
/* Some assignments are not allowed. */
class Main {
public void foo() {
}
public static void main(String[] args) {
Main m = new Main();
m.foo() = 1;
}
}
/* Some assignments are not allowed. */
class Main {
public static void main(String[] args) {
null = 1;
}
}
/* Some assignments are not allowed. */
class Main {
public static void main(String[] args) {
false = true;
}
}
/* Some assignments are not allowed. */
class Main {
public static void main(String[] args) {
0 = 1;
}
}
/* Some assignments are not allowed. */
class Main {
public void bar() {
}
public void foo() {
bar() = 1;
}
public static void main(String[] args) {
}
}
/* Method invocation is missing parentheses */
class Foo {
public int i;
public void bar() {
}
}
class Main {
public static void main(String[] args) {
Foo foo = new Foo();
foo.bar;
}
}
/* `void` cannot be used outside of the return type. */
class Main {
public static void main(String[] args) {
void x;
}
}
/* `void` cannot be used outside of the return type. */
class Main {
public void x;
public static void main(String[] args) {
}
}
/* `void` cannot be used outside of the return type. */
class Main {
public void foo(void x) {
}
public static void main(String[] args) {
}
}
/* OK */
class Main {
public static void main(String[] args) {
int x = 1;
(x) = 2;
}
}
/* NOT OK */
class Main {
public static void main(String[] i) {
String s = i[0];
}
}
/* It is not allowed to call the main method */
class Main {
public static void main(String[] args) {
main(args);
}
}
/* This should fail, because the main method doesn't have the static keyword */
class Main {
public void main(String[] args) {
}
}
/* This should fail because there is no main method (with public static) */
class Main {
public void main(String[] args) {
}
}
/* Methods that are called need to be declared. */
class Main {
public void foo() {
}
public static void main(String[] args) {
Main m = new Main();
m.bar();
}
}
/* All control paths need a return. */
class Main {
public int foo() {
if (0 == 0) {
return 1;
} else {
}
}
public static void main(String[] args) {
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment