File: verify.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (35 lines) | stat: -rw-r--r-- 1,934 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Tests for the Swift frontends `-verify` mode.

// RUN: not %target-typecheck-verify-swift 2>&1 | %FileCheck %s

// CHECK: [[@LINE+1]]:1: error: unexpected error produced: cannot find 'undefinedFunc' in scope
undefinedFunc()

// CHECK: [[@LINE+1]]:4: error: expected error not produced
// expected-error{{This error message never gets output}}

anotherUndefinedFunc()
// CHECK: [[@LINE+1]]:13: error: expected warning, not error
// expected-warning@-2 {{cannot find 'anotherUndefinedFunc' in scope}}

// CHECK: [[@LINE+1]]:20: error: expected {{{{}} in {{expected}}-{{warning}}
// expected-warning

func fn() {}
fn(())    // expected-error {{argument passed to call that takes no arguments}}
fn(())    // expected-error {{argument passed to call that takes no arguments}} {{4-6=}}
fn(())    // expected-error {{argument passed to call that takes no arguments}} {{4-6=}}||{{3-4=fnord}}
fn(())    // expected-error {{argument passed to call that takes no arguments}} {{3-4=fnord}} || {{4-6=}}
fn(())    // expected-error {{argument passed to call that takes no arguments}} {{4-6=}} {{none}}
fn(())    // expected-error {{argument passed to call that takes no arguments}} {{4-6=}}||{{3-4=fnord}} {{none}}
fn(())    // expected-error {{argument passed to call that takes no arguments}} {{3-4=fnord}}||{{4-6=}} {{none}}

// CHECK: [[@LINE+1]]:81: error: expected fix-it not seen; actual fix-it seen: {{[{][{]4-6=[}][}]}}
fn(())    // expected-error {{argument passed to call that takes no arguments}} {{3-4=fnord}} {{4-6=}}

// CHECK: [[@LINE+1]]:81: error: expected no fix-its; actual fix-it seen: {{[{][{]4-6=[}][}]}}
fn(())    // expected-error {{argument passed to call that takes no arguments}} {{none}}

// CHECK: [[@LINE+2]]:8: error: unexpected error produced: generic type 'Array' specialized with too many type parameters
// CHECK: note: diagnostic produced elsewhere: generic type 'Array' declared here
let x: Array<Int, Int>