mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Right before generating constraints for the new system, check if there are any BindOptionalExpr in the tree which wrap DiscardAssignmentExpr, such situation corresponds to syntax like - `_? = <value>`, since it doesn't really make sense to have optional assignment to discarded LValue which can never be optional, we can remove BOE from the tree and avoid generating any of the uncessary constraints.
85 lines
1004 B
Swift
85 lines
1004 B
Swift
// This source file is part of the Swift.org open source project
|
|
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
|
|
// RUN: not %target-swift-frontend %s -emit-ir
|
|
{
|
|
do{for{("""
|
|
if(t:_?==_{}false?
|
|
{}().{}{_{{_
|
|
_[]{for{)
|
|
(_{true{
|
|
&.>"""
|
|
_..._
|
|
(0(
|
|
&)...f>{$0{_
|
|
{
|
|
_.f>{nil-{
|
|
&true?{
|
|
&{\n&(
|
|
(t:_
|
|
#if8=1,{
|
|
.{&()
|
|
{[_
|
|
{[1
|
|
_?={Int
|
|
[(Int:_{
|
|
{(0{Array
|
|
{}{$0(Int:_[&._{_{{
|
|
-{&true
|
|
{{_?=nil._=_
|
|
R{
|
|
{
|
|
({
|
|
_
|
|
a?=_{_
|
|
nil as(0{(t:_{_?==(t:_?=nil-{_
|
|
(({
|
|
&
|
|
Array
|
|
{[[[]{_>{[map
|
|
[]{_
|
|
&(*)
|
|
{
|
|
{[[[]
|
|
Ran]
|
|
_
|
|
{true[_?={{[true[&[_
|
|
if()
|
|
-{(
|
|
{Array
|
|
[]{true?=[](<{_
|
|
true
|
|
true[]
|
|
{true{\n&_[]
|
|
for{(_{_
|
|
#if8=_
|
|
{
|
|
-_?
|
|
[]
|
|
nil (""",{for{_{
|
|
(
|
|
[(0^_..A[[-{
|
|
&._
|
|
var()
|
|
&{nil-{{&(-{Int:_?=nil.{{{_?
|
|
{_?=(_?
|
|
-.{&[1,_._[&{_?
|
|
{
|
|
&.A[-{_
|
|
{
|
|
&([map
|
|
-{{&_?,{_{{
|
|
[]
|
|
_?
|
|
&true[()
|
|
&)
|
|
Slice.f>_
|
|
{
|
|
&_?=0^_
|
|
&("
|
|
{_===\n{_.f\n&true
|