Commit Graph
1262 Commits
Author SHA1 Message Date
micttyl c63ae9b05d Prefix Fail to Failing Test (#2212) 2022-09-24 11:40:08 -07:00
Jon Ross-Perkins f417be79d2 Run apt-get update and install together (#2192)
This is a recommended best practice: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#apt-get
2022-09-22 15:16:17 -07:00
Jon Ross-Perkins 1248831001 Emphasize Discord for design (#2206) 2022-09-22 12:38:26 -07:00
Jon Ross-Perkins 6293610cb0 Replace dashes with underscores in llvm-patches (#2211)
Dashes in bazel package names in particular can cause problems (which renaming `llvm-patches` to `llvm_patches` will fix for me). But we've generally named files with underscores, so there's also consistency.
2022-09-22 12:37:24 -07:00
Jon Ross-Perkins c87a914bbd pre-commit update (#2210)
pre-commit autoupdate --freeze && pre-commit run -a

(no other edits, just the one version update)
2022-09-22 11:00:29 -07:00
micttyl dc4e968373 Fix Markdown (#2208)
`explicit parameter` to have its closing rendered correctly.

Change all html-like(still supported though) notations into the Markdown style.
2022-09-22 09:01:36 -07:00
josh11b e941b90ac9 Correctly remove ## TODO section from proposals (#2207)
Fix bug introduced in #2139
2022-09-22 08:20:07 -07:00
Jon Ross-Perkins 1dcd15380c Remove stacked PR notes (#2205)
chandlerc had originally added these and previously expressed being okay with removing them. They've just proven too complex to be applied; it needs to be easier for people to want to do it.
2022-09-21 16:10:36 -07:00
micttyl 804a09bccd Do not lead people to github discussion (#2204) 2022-09-21 16:06:03 -07:00
Richard Smith ff1d69232b Switch proposal link text from pNNNN to #NN for consistency (#2202)
This is the only occurrence of using pNNNN in text to refer to a Carbon proposal in the repo. This gets us closer to following https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/design_style_guide.md.
2022-09-21 10:37:07 -07:00
micttyl 2df87ddacc Include Missing Libraries (#2201)
Minor Style: non-auto to auto
2022-09-21 09:09:13 -07:00
b464a0ac3d Unused Pattern Bindings (Unused Function Parameters) (#2022)
This proposal specifies how unused pattern bindings are written in the Carbon programming language. This is a more general problem statement of "how do users specify unused function parameters" as function parameter declarations are a more specific form of pattern

Related issue #1996

Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-09-20 17:44:22 -07:00
Jon Ross-Perkins 9be6939ee9 Fix LLVM compilation issues (#2198)
We've been having issues with asan builds on linux. This change should fix all of that. A build run can be found at:
https://github.com/carbon-language/carbon-lang/actions/runs/3093378863/jobs/5005683059

(currently in progress, but I'm expecting it to succeed at this point)

It may be that the issues with asan builds were actually related to caching. That is, maybe the brew build command didn't change enough between v14 and v15 that the cache hits were still an issue. We did notice this with 15.0.0 versus 15.0.1 include paths (that is, bazel wasn't happy using the cached results of a 15.0.0 build due to the skew in include paths). In order to address this, I've added CACHE_VERSION to the remote_cache setup. I've also set up corresponding buckets in Cloud.

However, I'm also switching Linux to llvm-15 and apt. I'd originally been looking at this because the issues were linux-specific, and we've previously had linux-specific issues with Homebrew. Although it may have been the cache all along, I would prefer to keep this setup (if nothing else, it made the caching issues more obvious, even though we were still confused by the include path manifestation).
2022-09-20 14:21:02 -07:00
Jon Ross-Perkins 174aff1f2d Remove legacy mention of bazel-clang-toolchain symlink (#2190) 2022-09-19 21:34:47 -07:00
Jon Ross-Perkins 7e4e73b6c0 Specify llvm@14 (#2195)
This should be temporary while trying to diagnose why llvm@15 fails.
2022-09-19 16:20:54 -07:00
Junhee Cho 69d4363ea5 Adds division to multiplicative expression. (#2091)
* Multiplication and division have the same priority.
* A new builtin interface DivWith is added.
* In some tests expecting a compilation error (syntax error), the error
  message now says it is expecting SLASH or binary *.
2022-09-19 15:02:29 -07:00
micttyl 57cc4c6dec Include Missing Libraries (#2193)
For better:
	`<iterator>` for `std::reverse_iterator`
	`Optional.h` for `llvm::Optional`
2022-09-19 11:22:01 -07:00
Jon Ross-Perkins c8faa47f83 Add llvm to PATH instead of CC (#2189)
This helps VS Code find clangd (instead of needing to pass in clangd-15 somehow), and seems like it'll work in general.
2022-09-16 08:29:37 -07:00
Jon Ross-Perkins b80e294b6c Make structs to distinguish ID versus NodeStore index (#2171)
WDYT of this, to avoid raw int32_t indices? I was looking at the code again and found it hard to sort out. I think this doesn't have overhead.
2022-09-15 14:36:50 -07:00
Jon Ross-PerkinsandRichard Smith 005ab78766 Remove indirection for builtin operator tests (#2109)
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-09-15 14:36:20 -07:00
Jon Ross-Perkins 360f905755 Remove update_label_access, which is obsolete (#2184)
The PyGithub import is causing problems for me in test execution, but TBH I don't think we need it anymore. I should probably update groups.md though.
2022-09-15 13:57:50 -07:00
Jon Ross-Perkins aba77b12b9 Modify clang configuration to make llvm-15 work better. (#2186)
The debug flag change is discussed at https://github.com/llvm/llvm-project/issues/57637

This modifies the devcontainer Dockerfile to switch to an ubuntu and apt-based llvm-15. That was used in testing of these changes. The move away from brew is partly necessary if we want llvm-15, but also installs much faster (roughly 90s setup).

This was based in part on #1618
2022-09-15 13:23:59 -07:00
Jon Ross-Perkins c25a2b23d2 Switch gtest to re2, adjust related tests (#2183)
See https://github.com/google/googletest/blob/main/docs/advanced.md#regular-expression-syntax for gtest regex notes.

Add framework suffix handling for includes because of a dep being triggered on macos.
2022-09-15 08:19:52 -07:00
Richard Smith bfcab23795 Implement == and != for bool. (#2182) 2022-09-14 21:55:39 -07:00
Jon Ross-Perkins 81cdbfe650 Move -pie to linux_flags, add -fpie for macos (#2175)
I think this partly addresses #1404
2022-09-14 14:04:34 -07:00
Jon Ross-Perkins 6ce534a1e3 Add support for silencing nano zone warnings that arise from asan+macOS (#2177)
Note this will need to be set per-cc_binary, but I don't think there's a good way to avoid that.

I didn't try hijacking the `cc_binary` rule name because that felt a bit excessive. We probably will have a few binaries we want to run directly, but I don't think it needs to be addressed on every last one.

This is part of addressing #1404
2022-09-14 10:30:06 -07:00
josh11b e873678c8f Link to Rust stabilizing Generic Associated Types (GATs) (#2178) 2022-09-13 16:39:19 -07:00
Jon Ross-Perkins a62e2dc21c Update things for clang-15 support. (#2174)
libprotobuf_mutator and abseil have warnings that are already fixed in newer versions.

bison outputs code that hits new warnings; there I'm just silencing it because testing a newer bison version is more difficult.

Fixes #1650

Fixes #1660
2022-09-13 15:18:55 -07:00
Richard Smith deee3a97de Implement #2140 in the design docs. (#2176)
This implements #2140 in the design docs.
2022-09-13 14:54:43 -07:00
Richard SmithandJon Ross-Perkins 0191e2e41e implement checking for pattern match exhaustiveness and for unreachable cases (#2164)
When checking for control flow falling off a function after a `match`, determine whether it's possible for no case to have matched. Using the same implementation, also detect whether `case`s in a `match` are unreachable.

For now, the implementation never considers a match against specific values for any type other than tuples, alternatives, and `bool` to be exhaustive. In particular, matching against the sole value `{}` of type `{}` is not considered exhaustive. This is probably best left until explorer supports matching on struct and maybe class types more generally.

This implementation closely follows the algorithm described in the paper [Warnings for pattern matching](http://moscova.inria.fr/~maranget/papers/warn/warn.pdf) by Luc Maranget. Various optimizations are possible, such as reducing the amount of copying done, but for the purposes of explorer, comprehensibility is being favored over efficiency.

The problem is, perhaps surprisingly, co-NP-hard (by reduction to the tautology problem for disjunctive normal form, which is in turn dual to the satisfaction problem for conjunctive normal form, which is well-known to be NP-hard). The algorithm is therefore exponential-time in the worst case, but seems to be well-studied and performs well enough on non-pathological examples. Nonetheless, a depth limit has been imposed to prevent pathological examples such as those generated by a fuzzer from causing long runtimes.

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-09-13 13:40:25 -07:00
micttyl b5e55556be Include the Library of the added function in carbon-language#1341 (#2172)
`cstdlib` is added for `abort()` in carbon-language#1341

`unistd.h` was not removed with `exit()` in carbon-language#1175
2022-09-13 11:47:17 -07:00
Jon Ross-Perkins 2db09a1fd5 Rename dashes in a few test files to underscores (#2170)
This is somewhat https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/cpp_style_guide.md#file-names, but in general, underscores are more consistent.
2022-09-13 09:39:47 -07:00
josh11bandChandler Carruth 54059801ca More etiquette for responding to code reviews (#2169)
Includes the advice from https://github.com/carbon-language/carbon-lang/pull/2022#issuecomment-1239070023

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
2022-09-13 08:15:43 -07:00
micttyl e2f4205ca3 Enable Local Patches (#2168)
Configure `WORKSPACE` so to use patches that we have in
the current repository
2022-09-12 10:31:07 -07:00
micttyl f3e1186a87 Fix for Minor Style Issue: a non-auto method to auto (#2166)
Minor Style Change: a non-auto method to auto

Change the comment to address the correct function name

Sort the Members of `TokenizedBuffer` according to the YAML format

Fix to have the preferred term, `nul` over `null`

Include the library of the added function in carbon-language#2030
2022-09-12 10:24:58 -07:00
josh11bandRichard Smith 83f1d29f3c Checked and template generic terminology (#2138)
Change terminology from "generics" and "templates" to "checked generics" and "template generics". Afterwards, "generics" will be an umbrella term that include templates.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-09-09 21:15:46 -07:00
Jon Ross-Perkins 3704e942a2 Use a regex for the assert line (#2163)
Fixes the test (which had a line 431 versus 481 lissue)
2022-09-09 14:21:41 -07:00
Andy Soffer 1b4544ffed Add support to rewriter for free-function declarations and definitions. (#2120) 2022-09-09 13:30:23 -07:00
pmqttandm new 82f8556890 Implementation of __intrinsic_assert (#2155)
Co-authored-by: m new <michael.burzan@outlook.de>
2022-09-09 13:05:42 -07:00
pmqttandm new 5ef6e9b6a0 Feature not equal (#2146)
Implement != operator.

Co-authored-by: m new <michael.burzan@outlook.de>
2022-09-09 12:25:20 -07:00
c096d010b9 Optional Class (#2096)
Adding Optional class to prelude...
I hope it is useful!

Co-authored-by: m new <michael.burzan@outlook.de>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Geoff Romer <gromer@google.com>
2022-09-09 11:15:17 -07:00
Jon Ross-Perkins 5456011980 Detect and fix gtest and gmock dependencies. (#2099)
Fixes #1219 

The repo is correct, I'm just trying to avoid regressions from this.
2022-09-09 11:11:56 -07:00
josh11b 14206da00a Primitive types (#1975)
A few changes:
- Merge content from the `primitive_types.md` design doc into the overall design `README.md` since there was so much overlap and no need for two copies.
- Consistently spell integer types `Carbon.Int(N)` and `Carbon.UInt(N)`, including the `Carbon.` prefix and avoiding `Unsigned(N)`.
- Consistently use a comprehensive set of floating-point types.
- Incorporates #2015 into the design docs.
2022-09-08 18:13:09 -07:00
Geoff Romer 9db5c4e4b8 Run update_checks.py (#2158) 2022-09-08 17:29:12 -07:00
Jon Ross-Perkins 0c20fbb0e6 Switch to llvm apt for ubuntu (#2160)
We've been encountering issues installing llvm via brew on linux, e.g.:
https://github.com/carbon-language/carbon-lang/runs/8258419618?check_suite_focus=true

```
==> Reinstalling 2 dependents with broken linkage from source:
llvm, mpdecimal
```

(but then llvm doesn't get reinstalled)

This should resolve it:
https://github.com/carbon-language/carbon-lang/runs/8260573590?check_suite_focus=true
2022-09-08 16:41:33 -07:00
49c9732e8e Numeric type literal syntax (#2015)
This proposal aims to add a literal syntax for fixed-sized numeric types: integers, unsigned integers, and floating-point numbers.

Fixes #1998

Co-authored-by: josh11b <josh11b@users.noreply.github.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2022-09-08 15:49:11 -07:00
josh11b e4595deb4b Clarify rules around Self and .Self (#2107)
A number of smaller changes grouped together in one proposal:

-   Make `Self` a keyword.
-   Clarify that `Self` refers to the current type in a base class and in impl declarations.
-   Clarify when `.Self` is legal, and what type it has.
-   Also specify that `where` is not an associative operator.
2022-09-08 13:04:58 -07:00
Jon Ross-Perkins 6a9326f9e7 Set HOMEBREW_NO_INSTALL_CLEANUP due to llvm reinstall errors (#2157)
Trying to address issues like:
https://github.com/carbon-language/carbon-lang/runs/8252863868?check_suite_focus=true

```
==> Reinstalling 2 dependents with broken linkage from source:
llvm, mpdecimal
```

But llvm doesn't get reinstalled (but we also probably don't need/want this, particularly building from source).
2022-09-08 09:28:00 -07:00
Geoff RomerandJon Ross-Perkins 36a5a52a84 Add FAQ entries for common syntax questions (#2011)
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
2022-09-07 23:54:11 +03:00
Kareem Ergawyandergawy d44cde3c15 [Toolchain][Parser] Add support for package directive. (#2144)
Summary:

Adds parsing support for the `package` directive as specified by the
`Code and name organization` design doc.

Co-authored-by: ergawy <kareem.ergawy@guardsquare.com>
2022-09-07 10:54:27 +03:00