Source file test/fixedbugs/issue19679.go

     1  // compile
     2  
     3  // Copyright 2017 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Used to crash when a type switch was present in dead code
     8  // in an inlineable function.
     9  
    10  package p
    11  
    12  func Then() {
    13  	var i interface{}
    14  	if false {
    15  		switch i.(type) {
    16  		}
    17  	}
    18  }
    19  
    20  func Else() {
    21  	var i interface{}
    22  	if true {
    23  		_ = i
    24  	} else {
    25  		switch i.(type) {
    26  		}
    27  	}
    28  }
    29  
    30  func Switch() {
    31  	var i interface{}
    32  	switch 5 {
    33  	case 3:
    34  		switch i.(type) {
    35  		}
    36  	case 5:
    37  	}
    38  }
    39  

View as plain text