[Bug 1239] New: Parsing error in basic expressions
https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1239 Summary: Parsing error in basic expressions Product: Swift Version: 0.95 Platform: All OS/Version: All Status: ASSIGNED Severity: major Priority: P1 Component: SwiftScript language AssignedTo: [email protected] ReportedBy: [email protected] CC: [email protected] Expressions of the form: x = func() op func(); fail. But if the expression is done in a declaration: float x = func() op func(); they seem to work. Examples below. $ cat div4.swift float x = toFloat(1) / toFloat(2); # float x; x = toFloat(1) / toFloat(2); tracef("x=%f\n", x); $ swift div4.swift Swift trunk swift-r7759 cog-r3890 RunID: run021 Progress: Tue, 08 Apr 2014 22:06:59+0000 x=0.5 Final status:Tue, 08 Apr 2014 22:06:59+0000 $ cat div4.swift # float x = toFloat(1) / toFloat(2); float x; x = toFloat(1) / toFloat(2); tracef("x=%f\n", x); $ swift div4.swift Swift trunk swift-r7759 cog-r3890 RunID: run022 Could not compile SwiftScript source: line 2:27: expecting a semicolon, found '/' $ cat div4.swift # float x = toFloat(1) / toFloat(2); float x; x = toFloat(1) + toFloat(2); tracef("x=%f\n", x); $ swift div4.swift Swift trunk swift-r7759 cog-r3890 RunID: run023 Could not compile SwiftScript source: line 2:27: expecting a semicolon, found '+' $ -- 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=1239 Mihael Hategan <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #1 from Mihael Hategan <[email protected]> 2014-04-15 04:20:13 --- Fixed in swift r7768. The parser had a prediction rule that assumed that anything of the form 'x = xyz(...' must be a procedure invocation that gets translated to xyz(x, ...). This was broken in cases when xyz(... was part of an expression. The fix removes that prediction and deals with the issue in the compiler. -- 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