JetForMe
(Rick M)
1
I think the error I'm getting here is misleading. Should I file a bug?
import CoreGraphics
func
+=(inLHS : inout CGPoint, inRHS : CGPoint)
{
inLHS.x += inRHS.x
inLHS.y += inRHS.y
}
struct
PathPoint
{
var anchorPt: CGPoint?
}
var points = [PathPoint()]
let dv = CGPoint(x: 0, y: 0)
points[0].anchorPt = dv
points[0].anchorPt += dv
Playground execution failed: error: MyPlayground.playground:17:7: error: cannot subscript a value of type 'inout [PathPoint]' (aka 'inout Array<PathPoint>')
points[0].anchorPt += dv
~~~~~~^
···
--
Rick Mann
rmann@latencyzero.com
jrose
(Jordan Rose)
2
Hi, Rick. The error seems to be a little better in master:
<stdin>:20:11: error: cannot convert value of type 'CGPoint?' to expected argument type 'inout CGPoint'
points[0].anchorPt += dv
~~~~~~~~~~^~~~~~~~
but that's still not great. So, yes, please do file a bug at bugs.swift.org <Issues · apple/swift · GitHub.
Thank you!
Jordan
···
On Nov 11, 2016, at 13:29, Rick Mann via swift-users <swift-users@swift.org> wrote:
I think the error I'm getting here is misleading. Should I file a bug?
import CoreGraphics
func
+=(inLHS : inout CGPoint, inRHS : CGPoint)
{
inLHS.x += inRHS.x
inLHS.y += inRHS.y
}
struct
PathPoint
{
var anchorPt: CGPoint?
}
var points = [PathPoint()]
let dv = CGPoint(x: 0, y: 0)
points[0].anchorPt = dv
points[0].anchorPt += dv
Playground execution failed: error: MyPlayground.playground:17:7: error: cannot subscript a value of type 'inout [PathPoint]' (aka 'inout Array<PathPoint>')
points[0].anchorPt += dv
~~~~~~^
--
Rick Mann
rmann@latencyzero.com
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users
JetForMe
(Rick M)
3
Done: [SR-3190] Misleading error message: cannot subscript a value of type 'inout [PathPoint]' with optional field · Issue #45778 · apple/swift · GitHub
Thanks!
···
On Nov 11, 2016, at 15:23 , Jordan Rose <jordan_rose@apple.com> wrote:
Hi, Rick. The error seems to be a little better in master:
<stdin>:20:11: error: cannot convert value of type 'CGPoint?' to expected argument type 'inout CGPoint'
points[0].anchorPt += dv
~~~~~~~~~~^~~~~~~~
but that's still not great. So, yes, please do file a bug at bugs.swift.org.
Thank you!
Jordan
On Nov 11, 2016, at 13:29, Rick Mann via swift-users <swift-users@swift.org> wrote:
I think the error I'm getting here is misleading. Should I file a bug?
import CoreGraphics
func
+=(inLHS : inout CGPoint, inRHS : CGPoint)
{
inLHS.x += inRHS.x
inLHS.y += inRHS.y
}
struct
PathPoint
{
var anchorPt: CGPoint?
}
var points = [PathPoint()]
let dv = CGPoint(x: 0, y: 0)
points[0].anchorPt = dv
points[0].anchorPt += dv
Playground execution failed: error: MyPlayground.playground:17:7: error: cannot subscript a value of type 'inout [PathPoint]' (aka 'inout Array<PathPoint>')
points[0].anchorPt += dv
~~~~~~^
--
Rick Mann
rmann@latencyzero.com
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users
--
Rick Mann
rmann@latencyzero.com