Skip to content

Commit

Permalink
Fix bugzilla 24738 - Import core.interpolation suggestion (#16838)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkorpel authored and adamdruppe committed Sep 20, 2024
1 parent c70dcbc commit 3e3c0e5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 44 deletions.
2 changes: 2 additions & 0 deletions compiler/src/dmd/imphint.d
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ shared static this()
"writeln": "std.stdio",
"__va_argsave_t": "core.stdc.stdarg",
"__va_list_tag": "core.stdc.stdarg",
"InterpolationHeader": "core.interpolation",
"InterpolationFooter": "core.interpolation",
];
}

Expand Down
98 changes: 54 additions & 44 deletions compiler/test/fail_compilation/imphint.d
Original file line number Diff line number Diff line change
@@ -1,53 +1,60 @@
/*
TEST_OUTPUT:
---
fail_compilation/imphint.d(53): Error: `printf` is not defined, perhaps `import core.stdc.stdio;` is needed?
fail_compilation/imphint.d(54): Error: `writeln` is not defined, perhaps `import std.stdio;` is needed?
fail_compilation/imphint.d(55): Error: `sin` is not defined, perhaps `import std.math;` is needed?
fail_compilation/imphint.d(56): Error: `cos` is not defined, perhaps `import std.math;` is needed?
fail_compilation/imphint.d(57): Error: `sqrt` is not defined, perhaps `import std.math;` is needed?
fail_compilation/imphint.d(58): Error: `fabs` is not defined, perhaps `import std.math;` is needed?
fail_compilation/imphint.d(61): Error: `AliasSeq` is not defined, perhaps `import std.meta;` is needed?
fail_compilation/imphint.d(62): Error: `appender` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(63): Error: `array` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(64): Error: `calloc` is not defined, perhaps `import core.stdc.stdlib;` is needed?
fail_compilation/imphint.d(65): Error: `chdir` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(66): Error: `dirEntries` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(67): Error: `drop` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(68): Error: `each` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(69): Error: `empty` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(70): Error: `enumerate` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(71): Error: `endsWith` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(72): Error: `enforce` is not defined, perhaps `import std.exception;` is needed?
fail_compilation/imphint.d(73): Error: `equal` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(74): Error: `exists` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(75): Error: `filter` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(76): Error: `format` is not defined, perhaps `import std.format;` is needed?
fail_compilation/imphint.d(77): Error: `free` is not defined, perhaps `import core.stdc.stdlib;` is needed?
fail_compilation/imphint.d(78): Error: `front` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(79): Error: `iota` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(80): Error: `isDir` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(81): Error: `isFile` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(82): Error: `join` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(83): Error: `joiner` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(84): Error: `malloc` is not defined, perhaps `import core.stdc.stdlib;` is needed?
fail_compilation/imphint.d(85): Error: `map` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(86): Error: `max` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(87): Error: `min` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(88): Error: `mkdir` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(89): Error: `popFront` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(90): Error: `realloc` is not defined, perhaps `import core.stdc.stdlib;` is needed?
fail_compilation/imphint.d(91): Error: `replace` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(92): Error: `rmdir` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(93): Error: `sort` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(94): Error: `split` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(95): Error: `startsWith` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(96): Error: `take` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(97): Error: `text` is not defined, perhaps `import std.conv;` is needed?
fail_compilation/imphint.d(98): Error: `to` is not defined, perhaps `import std.conv;` is needed?
fail_compilation/imphint.d(60): Error: `printf` is not defined, perhaps `import core.stdc.stdio;` is needed?
fail_compilation/imphint.d(61): Error: `writeln` is not defined, perhaps `import std.stdio;` is needed?
fail_compilation/imphint.d(62): Error: `sin` is not defined, perhaps `import std.math;` is needed?
fail_compilation/imphint.d(63): Error: `cos` is not defined, perhaps `import std.math;` is needed?
fail_compilation/imphint.d(64): Error: `sqrt` is not defined, perhaps `import std.math;` is needed?
fail_compilation/imphint.d(65): Error: `fabs` is not defined, perhaps `import std.math;` is needed?
fail_compilation/imphint.d(68): Error: `AliasSeq` is not defined, perhaps `import std.meta;` is needed?
fail_compilation/imphint.d(69): Error: `appender` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(70): Error: `array` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(71): Error: `calloc` is not defined, perhaps `import core.stdc.stdlib;` is needed?
fail_compilation/imphint.d(72): Error: `chdir` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(73): Error: `dirEntries` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(74): Error: `drop` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(75): Error: `each` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(76): Error: `empty` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(77): Error: `enumerate` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(78): Error: `endsWith` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(79): Error: `enforce` is not defined, perhaps `import std.exception;` is needed?
fail_compilation/imphint.d(80): Error: `equal` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(81): Error: `exists` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(82): Error: `filter` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(83): Error: `format` is not defined, perhaps `import std.format;` is needed?
fail_compilation/imphint.d(84): Error: `free` is not defined, perhaps `import core.stdc.stdlib;` is needed?
fail_compilation/imphint.d(85): Error: `front` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(86): Error: `iota` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(87): Error: `isDir` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(88): Error: `isFile` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(89): Error: `join` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(90): Error: `joiner` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(91): Error: `malloc` is not defined, perhaps `import core.stdc.stdlib;` is needed?
fail_compilation/imphint.d(92): Error: `map` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(93): Error: `max` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(94): Error: `min` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(95): Error: `mkdir` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(96): Error: `popFront` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(97): Error: `realloc` is not defined, perhaps `import core.stdc.stdlib;` is needed?
fail_compilation/imphint.d(98): Error: `replace` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(99): Error: `rmdir` is not defined, perhaps `import std.file;` is needed?
fail_compilation/imphint.d(100): Error: `sort` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(101): Error: `split` is not defined, perhaps `import std.array;` is needed?
fail_compilation/imphint.d(102): Error: `startsWith` is not defined, perhaps `import std.algorithm;` is needed?
fail_compilation/imphint.d(103): Error: `take` is not defined, perhaps `import std.range;` is needed?
fail_compilation/imphint.d(104): Error: `text` is not defined, perhaps `import std.conv;` is needed?
fail_compilation/imphint.d(105): Error: `to` is not defined, perhaps `import std.conv;` is needed?
fail_compilation/imphint.d(107): Error: `InterpolationHeader` is not defined, perhaps `import core.interpolation;` ?
fail_compilation/imphint.d(108): Error: template `heresy` is not callable using argument types `!()(InterpolationHeader, InterpolationFooter)`
fail_compilation/imphint.d(107): Candidate is: `heresy(Args...)(InterpolationHeader header, Args args, InterpolationFooter footer)`
---
*/





void foo()
{
printf("hello world\n");
Expand Down Expand Up @@ -96,4 +103,7 @@ void foo()
take();
text();
to();

void heresy(Args...)(InterpolationHeader header, Args args, InterpolationFooter footer) {}
heresy(i"");
}

0 comments on commit 3e3c0e5

Please sign in to comment.