Swiftui: @Enironment(.\dismiss) causes spurious compiler error

I want to allow the OK button to return from a scene to the calling form. But when I add

@Environment(\.dismiss) private var dismiss: DismissAction

which I use in a number of other views, a spurious error appears.

This seems to be a bug in the IDE, though I hate to say that.

Here is photographic evidence:

No error here:

Error here:

Can anyone shed any light on this?

Swiftui: @Enironment(.\dismiss) causes spurious compiler error
 
 
Q