Source file test/fixedbugs/issue24651b.go

     1  //errorcheck -0 -m -m
     2  
     3  // Copyright 2018 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  package main
     8  
     9  //go:norace
    10  func Foo(x int) int { // ERROR "can inline Foo with cost .* as: func\(int\) int { return x \* \(x \+ 1\) \* \(x \+ 2\) }$"
    11  	return x * (x + 1) * (x + 2)
    12  }
    13  
    14  func Bar(x int) int { // ERROR "can inline Bar with cost .* as: func\(int\) int { return x \* \(x \+ 1\) \* \(x \+ 2\) }$"
    15  	return x * (x + 1) * (x + 2)
    16  }
    17  
    18  var x = 5
    19  
    20  //go:noinline Provide a clean, constant reason for not inlining main
    21  func main() { // ERROR "cannot inline main: marked go:noinline$"
    22  	println("Foo(", x, ")=", Foo(x)) // ERROR "inlining call to Foo"
    23  	println("Bar(", x, ")=", Bar(x)) // ERROR "inlining call to Bar"
    24  }
    25  

View as plain text