Skip to content

Tests: Verify MemberImportVisibility honors -public-module-name #81701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions test/NameLookup/members_transitive_public_module_name.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// RUN: %empty-directory(%t)
// RUN: split-file %s %t
// RUN: %target-swift-frontend -emit-module -o %t %t/LibCore.swift -public-module-name Lib
// RUN: %target-swift-frontend -emit-module -I %t -o %t %t/Lib.swift
// RUN: %target-swift-frontend -typecheck -primary-file %t/main.swift %t/other.swift -I %t -verify -swift-version 5 -enable-upcoming-feature MemberImportVisibility

// REQUIRES: swift_feature_MemberImportVisibility

//--- main.swift

import Swift
// expected-note {{add import of module 'Lib'}}

func foo(_ x: Int) -> Int {
x.bar // expected-error {{property 'bar' is not available due to missing import of defining module 'Lib'}}
}

//--- other.swift

import Lib

//--- Lib.swift

@_exported import LibCore

//--- LibCore.swift

extension Int {
public var bar: Int {
return self < 0 ? -self : self
}
}