File tree Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -9665,7 +9665,10 @@ Type MacroDecl::getResultInterfaceType() const {
9665
9665
}
9666
9666
9667
9667
SourceRange MacroDecl::getSourceRange () const {
9668
- return SourceRange (macroLoc, externalMacroTypeNameLoc);
9668
+ SourceLoc endLoc = externalMacroTypeNameLoc;
9669
+ if (auto trailing = getTrailingWhereClause ())
9670
+ endLoc = trailing->getSourceRange ().End ;
9671
+ return SourceRange (macroLoc, endLoc);
9669
9672
}
9670
9673
9671
9674
SourceRange MacroExpansionDecl::getSourceRange () const {
Original file line number Diff line number Diff line change @@ -4880,6 +4880,9 @@ void TypeChecker::checkExistentialTypes(Decl *decl) {
4880
4880
checkExistentialTypes (ctx, funcDecl->getGenericParams ());
4881
4881
checkExistentialTypes (ctx, funcDecl->getTrailingWhereClause ());
4882
4882
}
4883
+ } else if (auto *macroDecl = dyn_cast<MacroDecl>(decl)) {
4884
+ checkExistentialTypes (ctx, macroDecl->getGenericParams ());
4885
+ checkExistentialTypes (ctx, macroDecl->getTrailingWhereClause ());
4883
4886
}
4884
4887
4885
4888
if (isa<TypeDecl>(decl) || isa<ExtensionDecl>(decl))
Original file line number Diff line number Diff line change 1
1
// RUN: %target-swift-frontend -enable-experimental-feature Macros -enable-experimental-feature BuiltinMacros -dump-ast %s -module-name MacrosTest 2>&1 | %FileCheck %s
2
2
// REQUIRES: OS=macosx
3
3
4
- macro function< T: ExpressibleByStringLiteral > : T = _SwiftSyntaxMacros. FunctionMacro
4
+ macro function< T> : T = _SwiftSyntaxMacros. FunctionMacro where T : ExpressibleByStringLiteral
5
5
macro line< T: ExpressibleByIntegerLiteral > : T = _SwiftSyntaxMacros. LineMacro
6
6
macro column< T: ExpressibleByIntegerLiteral > : T = _SwiftSyntaxMacros. ColumnMacro
7
7
Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift -enable-experimental-feature Macros -module-name MacrosTest
2
+ // REQUIRES: OS=macosx
3
+
4
+ macro stringify< T> ( _ value: T ) -> ( T , String ) = BuiltinMacros . StringifyMacro
5
+
6
+ func test( a: Int , b: Int ) {
7
+ // FIXME: Bad diagnostic.
8
+ let s = #stringify < Int , Int > ( a + b) // expected-error{{type of expression is ambiguous without more context}}
9
+ }
You can’t perform that action at this time.
0 commit comments