Files
swift-mirror/test/Interpreter/interpolation.swift
Chris Lattner 2f44c0038c Initial stab at implementing string literal interpolation for simple expressions,
e.g. "foo is \(i+j)".  This implements rdar://11223686

Doug implemented all the hard parts of this.  I ripped out support for nested string
literals (i.e. string literals within an interpolated string), which simplified the
approach and defined away some problems with his patch in progress.  I plan a few refinements
on top of this basic patch.



Swift SVN r1738
2012-05-04 05:53:50 +00:00

12 lines
292 B
Swift

// RUN: %swift %s -i | FileCheck %s
var hello = "Hello"
var pi = 3
// CHECK: Hello, world. Pi is approximately 3.
println("\(hello), world. Pi is approximately \(pi).")
// CHECK: Nested "Hello, World!" with Pi = 3!
var HW = "\(hello), World!";
println("Nested \"\(HW)\" with Pi = \(pi)!")