concat.sol 764 B

1234567891011121314
  1. contract C {
  2. function f1(bytes1 a, bytes b) public returns (bytes c) { c = a + b; }
  3. function f2(bytes a, bytes2 b) public returns (bytes c) { c = a + b; }
  4. function f3(bytes a, bytes b) public returns (bytes c) { c = a + b; }
  5. function f4(string a, string b) public returns (string c) { c = a + b; }
  6. function f(string a, bytes b) public returns (bytes c) { c = a + b; }
  7. }
  8. // ---- Expect: diagnostics ----
  9. // error: 2:64-69: concatenate bytes using the builtin bytes.concat(a, b)
  10. // error: 3:64-69: concatenate bytes using the builtin bytes.concat(a, b)
  11. // error: 4:63-68: concatenate bytes using the builtin bytes.concat(a, b)
  12. // error: 5:66-71: concatenate string using the builtin string.concat(a, b)
  13. // error: 6:63-64: expression of type string not allowed