[Bug 1063] New: Parsing error on a simple expression
https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1063 Summary: Parsing error on a simple expression Product: Swift Version: 0.94 Platform: PC OS/Version: Mac OS Status: ASSIGNED Severity: major Priority: P1 Component: SwiftScript language AssignedTo: [email protected] ReportedBy: [email protected] The initialized declaration: int iscale = 1000 * incr(100); works, but putting the function call first: int jscale = incr(100) * 1000; yields this (I think erroneous) parsing error: Could not compile SwiftScript source: line 10:24: expecting a semicolon, found '*' (Unless Im missing something obvious...) Full example here: uc3$ cat t.swift (int j) incr (int i) { j = i + 1; } int iscale = 1000 * incr(100); tracef("iscale=%i\n", iscale); int jscale = incr(100) * 1000; tracef("jscale=%i\n", jscale); uc3$ swift t.swift Could not compile SwiftScript source: line 10:24: expecting a semicolon, found '*' uc3$ cp t.swift t2.swift uc3$ e t2.swift [3]+ Stopped emacs t2.swift uc3$ cat t2.swift (int j) incr (int i) { j = i + 1; } int iscale = 1000 * incr(100); tracef("iscale=%i\n", iscale); /* int jscale = incr(100) * 1000; tracef("jscale=%i\n", jscale); */ uc3$ swift t2.swift Swift 0.94.1-RC1 swift-r6829 cog-r3758 RunID: 20130817-1800-ig5ra7z6 Progress: time: Sat, 17 Aug 2013 18:00:20 -0500 iscale=101000 Final status: Sat, 17 Aug 2013 18:00:20 -0500 uc3$ -- Configure bugmail: https://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1063 --- Comment #1 from Mihael Hategan <[email protected]> 2013-08-25 14:38:41 --- Yeah. The swift parser has a problem. It thinks that it's an assignment of the form: type name = call(...); I'm not sure why that is treated as separately instead of type name[ = expr]; -- Configure bugmail: https://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1063 --- Comment #2 from Mihael Hategan <[email protected]> 2013-08-26 02:27:46 --- I removed the special treatment of procedure calls in assignments which was causing this problem. This problem is related to bug 1073 since the special mechanism for calls in assignments was used as a type inference mechanism for calls returning a wildcard type (let's call it the ANY type), so some modifications were needed to allow inference in expressions involving procedure calls. -- Configure bugmail: https://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1063 Mihael Hategan <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED -- Configure bugmail: https://bugzilla.mcs.anl.gov/swift/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
participants (1)
-
bugzilla-daemon@mcs.anl.gov