# Breaking Changes in Cadence parser? 🤔

**URL:** <https://forum.flow.com/t/breaking-changes-in-cadence-parser/485>\
**Category:** Flow JavaScript SDK\
**Tags:** flow-sdk-js\
**Created:** [July 23, 2020, 3:34pm UTC](https://forum.flow.com/t/breaking-changes-in-cadence-parser/485 "2020-07-23T15:34:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxStarka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/maxstarka/32/56_2.png) [@MaxStarka](https://forum.flow.com/u/MaxStarka)\
**Post date:** [July 23, 2020, 3:34pm UTC](https://forum.flow.com/t/breaking-changes-in-cadence-parser/485/1 "2020-07-23T15:34:43Z")

</div>

This one would work:

```
  const check = await fcl.send([
    sdk.script`pub fun main():Int { return 2 }`
  ]);
  const result = await fcl.decode(check);

```

This one will throw:

```
  const check = await fcl.send([
    sdk.script`pub fun main():Int{ return 2 }`
  ]);
  const result = await fcl.decode(check);

```

The only difference is the abscence of white space after `Int` type. As soon as you add it - it will work as well. Tried to run in Playground - both versions work just fine…

`level=warning msg="\x1b[1;31mERR\x1b[0m \x1b[2m[e5b19e]\x1b[0m Execution failed:\nParsing failed:\nunexpected token: got decimal integer, expected ',' or '}'\n:\n unexpected token: got decimal integer, expected ',' or '}'\n"`

---

<div class="post-metadata">

**Author:** ![MaxStarka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/maxstarka/32/56_2.png) [@MaxStarka](https://forum.flow.com/u/MaxStarka)\
**Post date:** [July 23, 2020, 3:44pm UTC](https://forum.flow.com/t/breaking-changes-in-cadence-parser/485/2 "2020-07-23T15:44:14Z")

</div>

I’ve checked different versions of emulators via Docker:

- 0.4.0 - Works just fine without space after `Int` type
- 0.5.0 and higher - Throws error

---

<div class="post-metadata">

**Author:** ![bastian](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/bastian/32/183_2.png) [@bastian](https://forum.flow.com/u/bastian)\
**Post date:** [July 23, 2020, 5:06pm UTC](https://forum.flow.com/t/breaking-changes-in-cadence-parser/485/3 "2020-07-23T17:06:39Z")

</div>

@MaxStarka Thank you for reporting this!

In [Cadence v0.5.0](https://github.com/onflow/cadence/releases/tag/v0.5.0) we’ve enabled the new parser, and it looks like the behaviour between the old and new one is different here.

The example above actually shows an ambiguity: Is the return type annotation `: Int{ ` the type `Int` and the open curly brace the beginning of the body of the function, or is it the start of a restricted type `Int{...}`?

I think given that the former is more common, we should probably parse it as that.  
I’ve opened a bug report in the Cadence repository and plan to fix it next week: [https://github.com/onflow/cadence/issues/258](https://github.com/onflow/cadence/issues/258)
